get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; // Theme important links started class COLORNEWS_Important_Links extends WP_Customize_Control { public $type = "colornews-important-links"; public function render_content() { //Add Theme instruction, Support Forum, Demo Link, Rating Link $important_links = array( 'theme-info' => array( 'link' => esc_url('http://themegrill.com/themes/colornews/'), 'text' => __('Theme Info', 'colornews'), ), 'support' => array( 'link' => esc_url('http://themegrill.com/support-forum/'), 'text' => __('Support', 'colornews'), ), 'documentation' => array( 'link' => esc_url('http://themegrill.com/theme-instruction/colornews/'), 'text' => __('Documentation', 'colornews'), ), 'demo' => array( 'link' => esc_url('http://demo.themegrill.com/colornews/'), 'text' => __('View Demo', 'colornews'), ), 'rating' => array( 'link' => esc_url('http://wordpress.org/support/view/theme-reviews/colornews?filter=5'), 'text' => __('Rate this theme', 'colornews'), ), ); foreach ($important_links as $important_link) { echo '
' . esc_attr($important_link['text']) . '
'; } } } $wp_customize->add_section('colornews_important_links', array( 'priority' => 1, 'title' => __('ColorNews Important Links', 'colornews'), )); /** * This setting has the dummy Sanitizaition function as it contains no value to be sanitized */ $wp_customize->add_setting('colornews_important_links', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'colornews_links_sanitize' )); $wp_customize->add_control(new COLORNEWS_Important_Links($wp_customize, 'important_links', array( 'label' => __('Important Links', 'colornews'), 'section' => 'colornews_important_links', 'settings' => 'colornews_important_links' ))); // Theme Important Links Ended // Start of the Header Options $wp_customize->add_panel('colornews_header_options', array( 'capabitity' => 'edit_theme_options', 'description' => __('Change the Header Settings from here as you want.', 'colornews'), 'priority' => 500, 'title' => __('Header Options', 'colornews') )); // logo upload options $wp_customize->add_section('colornews_header_logo', array( 'priority' => 1, 'title' => __('Header Logo', 'colornews'), 'panel' => 'colornews_header_options' )); $wp_customize->add_setting('colornews_logo', array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'colornews_logo', array( 'label' => __('Upload logo for your header here.', 'colornews'), 'section' => 'colornews_header_logo', 'setting' => 'colornews_logo' ))); $wp_customize->add_setting('colornews_header_logo_placement', array( 'default' => 'header_text_only', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'colornews_radio_select_sanitize' )); $wp_customize->add_control('colornews_header_logo_placement', array( 'type' => 'radio', 'label' => __('Choose the option that you want from below.', 'colornews'), 'section' => 'colornews_header_logo', 'choices' => array( 'header_logo_only' => __('Header Logo Only', 'colornews'), 'header_text_only' => __('Header Text Only', 'colornews'), 'show_both' => __('Show Both', 'colornews'), 'disable' => __('Disable', 'colornews') ) )); // home icon enable/disable in primary menu $wp_customize->add_section('colornews_home_icon_display_section', array( 'title' => __('Show Home Icon', 'colornews'), 'panel' => 'colornews_header_options' )); $wp_customize->add_setting('colornews_home_icon_display', array( 'priority' => 2, 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'colornews_checkbox_sanitize' )); $wp_customize->add_control('colornews_home_icon_display', array( 'type' => 'checkbox', 'label' => __('Check to enable the home icon in the primary menu.', 'colornews'), 'section' => 'colornews_home_icon_display_section', 'settings' => 'colornews_home_icon_display' )); // header top menu enable/disable $wp_customize->add_section('colornews_header_top_menu_display_section', array( 'title' => __('Show Header Top Bar', 'colornews'), 'panel' => 'colornews_header_options' )); $wp_customize->add_setting('colornews_header_top_menu_display', array( 'priority' => 1, 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'colornews_checkbox_sanitize' )); $wp_customize->add_control('colornews_header_top_menu_display', array( 'type' => 'checkbox', 'label' => __('Check to enable the header top bar. The top header bar includes category menu, date display and social menu .', 'colornews'), 'section' => 'colornews_header_top_menu_display_section', 'settings' => 'colornews_header_top_menu_display' )); $wp_customize->add_setting('colornews_header_top_menu_category_display', array( 'priority' => 2, 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'colornews_checkbox_sanitize' )); $wp_customize->add_control('colornews_header_top_menu_category_display', array( 'type' => 'checkbox', 'label' => __('Check to enable the category menu in the top header bar.', 'colornews'), 'section' => 'colornews_header_top_menu_display_section', 'settings' => 'colornews_header_top_menu_category_display' )); // date display enable/disable $wp_customize->add_section('colornews_date_display_section', array( 'title' => __('Show Date', 'colornews'), 'panel' => 'colornews_header_options' )); $wp_customize->add_setting('colornews_date_display', array( 'priority' => 2, 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'colornews_checkbox_sanitize' )); $wp_customize->add_control('colornews_date_display', array( 'type' => 'checkbox', 'label' => __('Check to show the date in header.', 'colornews'), 'section' => 'colornews_date_display_section', 'settings' => 'colornews_date_display' )); // search icon in menu enable/disable $wp_customize->add_section('colornews_search_icon_in_menu_section', array( 'title' => __('Search Icon', 'colornews'), 'panel' => 'colornews_header_options' )); $wp_customize->add_setting('colornews_search_icon_in_menu', array( 'priority' => 5, 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'colornews_checkbox_sanitize' )); $wp_customize->add_control('colornews_search_icon_in_menu', array( 'type' => 'checkbox', 'label' => __('Check to display the Search Icon in the primary menu.', 'colornews'), 'section' => 'colornews_search_icon_in_menu_section', 'settings' => 'colornews_search_icon_in_menu' )); // random posts in menu enable/disable $wp_customize->add_section('colornews_random_post_in_menu_section', array( 'title' => __('Random Post', 'colornews'), 'panel' => 'colornews_header_options' )); $wp_customize->add_setting('colornews_random_post_in_menu', array( 'priority' => 6, 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'colornews_checkbox_sanitize' )); $wp_customize->add_control('colornews_random_post_in_menu', array( 'type' => 'checkbox', 'label' => __('Check to display the Random Post Icon in the primary menu.', 'colornews'), 'section' => 'colornews_random_post_in_menu_section', 'settings' => 'colornews_random_post_in_menu' )); // breaking news enable/disable $wp_customize->add_section('colornews_breaking_news_section', array( 'title' => __('Breaking News', 'colornews'), 'panel' => 'colornews_header_options' )); $wp_customize->add_setting('colornews_breaking_news', array( 'priority' => 1, 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'colornews_checkbox_sanitize' )); $wp_customize->add_control('colornews_breaking_news', array( 'type' => 'checkbox', 'label' => __('Check to enable the breaking news section.', 'colornews'), 'section' => 'colornews_breaking_news_section', 'settings' => 'colornews_breaking_news' )); // primary menu sticky enable/disable $wp_customize->add_section('colornews_primary_sticky_menu_section', array( 'title' => __('Sticky Menu', 'colornews'), 'panel' => 'colornews_header_options' )); $wp_customize->add_setting('colornews_primary_sticky_menu', array( 'priority' => 4, 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'colornews_checkbox_sanitize' )); $wp_customize->add_control('colornews_primary_sticky_menu', array( 'type' => 'checkbox', 'label' => __('Check to enable the sticky behavior of the primary menu.', 'colornews'), 'section' => 'colornews_primary_sticky_menu_section', 'settings' => 'colornews_primary_sticky_menu' )); // header image position setting $wp_customize->add_section('colornews_header_image_position_setting', array( 'priority' => 6, 'title' => __('Header Image Position', 'colornews'), 'panel' => 'colornews_header_options' )); $wp_customize->add_setting('colornews_header_image_position', array( 'default' => 'position_two', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'colornews_radio_select_sanitize' )); $wp_customize->add_control('colornews_header_image_position', array( 'type' => 'radio', 'label' => __('Header image display position.', 'colornews'), 'section' => 'colornews_header_image_position_setting', 'choices' => array( 'position_one' => __('Display the Header image just above the site title/text.', 'colornews'), 'position_two' => __('Default: Display the Header image between site title/text and the main/primary menu.', 'colornews'), 'position_three' => __('Display the Header image below main/primary menu.', 'colornews') ) )); $wp_customize->add_setting('colornews_header_image_link', array( 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'colornews_checkbox_sanitize' )); $wp_customize->add_control('colornews_header_image_link', array( 'type' => 'checkbox', 'label' => __('Check to make header image link back to the home page.', 'colornews'), 'section' => 'colornews_header_image_position_setting' )); // End of Header Options // Start of the Design Options $wp_customize->add_panel('colornews_design_options', array( 'capabitity' => 'edit_theme_options', 'description' => __('Change the Design Settings from here as you want for your site.', 'colornews'), 'priority' => 505, 'title' => __('Design Options', 'colornews') )); // FrontPage setting $wp_customize->add_section('colornews_front_page_setting', array( 'priority' => 1, 'title' => __('Front Page Settings', 'colornews'), 'panel' => 'colornews_design_options' )); $wp_customize->add_setting('colornews_hide_blog_front', array( 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'colornews_checkbox_sanitize' )); $wp_customize->add_control('colornews_hide_blog_front', array( 'type' => 'checkbox', 'label' => __('Check to hide blog posts/static page on the front page.', 'colornews'), 'section' => 'colornews_front_page_setting' )); // site layout setting $wp_customize->add_section('colornews_site_layout_setting', array( 'priority' => 2, 'title' => __('Site Layout', 'colornews'), 'panel' => 'colornews_design_options' )); $wp_customize->add_setting('colornews_site_layout', array( 'default' => 'boxed_layout', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'colornews_radio_select_sanitize' )); $wp_customize->add_control('colornews_site_layout', array( 'type' => 'radio', 'label' => __('Choose the required layout for your site. The change is reflected in the whole site', 'colornews'), 'choices' => array( 'boxed_layout' => __('Boxed Layout', 'colornews'), 'wide_layout' => __('Wide Layout', 'colornews') ), 'section' => 'colornews_site_layout_setting' )); class COLORNEWS_Image_Radio_Control extends WP_Customize_Control { public function render_content() { if ( empty( $this->choices ) ) return; $name = '_customize-radio-' . $this->id; ?> label ); ?>