get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; } add_action( 'customize_register', 'blog64_customize_register' ); function blog64_customizer_register( $wp_customize ) { // Do stuff with $wp_customize, the WP_Customize_Manager object. $wp_customize->add_panel( 'theme_option', array( 'priority' => 60, 'title' => __( 'Theme Option', 'blog64' ), 'description' => __( 'Theme Option for Homepage.', 'blog64' ), )); /**********************************************/ /*************** LOGO SECTION *****************/ /**********************************************/ $wp_customize->add_section('theme_logo',array( 'priority' => 40, 'title' => __('Theme Logo','blog64'), 'description' => 'Upload image of 200px width and 52px height for logo', 'panel' => 'theme_option', )); $wp_customize->add_setting('logo_image',array( 'sanitize_callback' => 'esc_url_raw', 'default' => '' )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize,'logo_image',array( 'label' => __('Edit Theme Logo','blog64'), 'section' => 'theme_logo', 'settings' => 'logo_image' ) )); /**********************************************/ /*************** HEADER SECTION ***************/ /**********************************************/ $wp_customize->add_section('header_section',array( 'title' => __('Header Section','blog64'), 'description' => 'Configure Your Headings here', 'panel' => 'theme_option' )); /* ------ For Heading Section ------ */ $wp_customize->add_setting( 'blog64_heading', array( 'sanitize_callback' => 'blog64_sanitize_text', 'default' => '', ) ); $wp_customize->add_control( 'blog64_heading', array( 'label' => 'Homepage Heading', 'section' => 'header_section', 'settings' => 'blog64_heading', 'type' => 'text', ) ); /* ------ For Sub Heading Section ------ */ $wp_customize->add_setting( 'blog64_subheading', array( 'sanitize_callback' => 'blog64_sanitize_text', 'default' => '', ) ); $wp_customize->add_control( 'blog64_subheading', array( 'label' => 'Homepage Sub Heading', 'section' => 'header_section', 'settings' => 'blog64_subheading', 'type' => 'text', ) ); /* ------ For Action Button Section ------ */ $wp_customize->add_setting( 'blog64_button', array( 'sanitize_callback' => 'esc_url_raw', 'default' => '', ) ); $wp_customize->add_control( 'blog64_button', array( 'label' => 'Blog Button Url', 'section' => 'header_section', 'settings' => 'blog64_button', 'type' => 'text', ) ); /**********************************************/ /********** HOMEPAGE BACKGROUND SECTION **********/ /**********************************************/ $wp_customize->add_section('homepage_banner',array( 'title' => __('Banner Section','blog64'), 'description' => 'Upload 1920x900px Homepage Background Banner Image in Homepage', 'panel' => 'theme_option' )); $wp_customize->add_setting('blog64_bg_image',array( 'sanitize_callback' => 'esc_url_raw', 'default' => get_template_directory_uri().'/images/bg.jpg' )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize,'blog64_bg_image',array( 'label' => __('Edit Background Banner Image','blog64'), 'section' => 'homepage_banner', 'settings' => 'blog64_bg_image' ) )); /**********************************************/ /*************** BLOG LISTINGS SECTION ****************/ /**********************************************/ $wp_customize->add_section('blog64_listing_category',array( 'title' => __('Blog Listing Categories','blog64'), 'description' => 'Select the Category for Blog Listing Section in Homepage', 'panel' => 'theme_option' )); $wp_customize->add_setting('blog_category_display',array( 'sanitize_callback' => 'blog64_sanitize_category', 'default' => '' )); $wp_customize->add_control(new blog64_Customize_Dropdown_Taxonomies_Control($wp_customize,'blog_category_display',array( 'label' => __('Choose category','blog64'), 'section' => 'blog64_listing_category', 'settings' => 'blog_category_display', 'type'=> 'dropdown-taxonomies', ) )); /**********************************************/ /*************** FOOTER SECTION ***************/ /**********************************************/ $wp_customize->add_section( 'footer_section', array( 'title' => 'Footer Settings', 'description' => 'This section includes Footer Copyrights and Social Icons Settings.', 'panel' => 'theme_option' ) ); /**********************************************/ /*************** COPYRIGHTS SECTION **************/ /**********************************************/ $wp_customize->add_setting( 'copyright_textbox', array( 'sanitize_callback' => 'blog64_sanitize_text', 'default' => '', ) ); $wp_customize->add_control( 'copyright_textbox', array( 'label' => 'Copyright text', 'section' => 'footer_section', 'settings' => 'copyright_textbox', 'type' => 'text', ) ); /**********************************************/ /******* SOCIAL ICON HIDE/ DISPLAY SECTION ********/ /**********************************************/ $wp_customize->add_setting('blog64_socialicon_display',array( 'sanitize_callback' => 'blog64_sanitize_text', 'default' => '' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize,'blog64_socialicon_display',array( 'label' => __('Show social icons','blog64'), 'section' => 'footer_section', 'settings' => 'blog64_socialicon_display', 'type'=> 'checkbox', )) ); /**********************************************/ /********** SOCIAL ICON LINKS SECTION ***********/ /**********************************************/ $wp_customize->add_setting( 'facebook_textbox', array( 'sanitize_callback' => 'esc_url_raw', 'default' => '', ) ); $wp_customize->add_control( 'facebook_textbox', array( 'label' => 'Facebook', 'section' => 'footer_section', 'settings' => 'facebook_textbox', 'type' => 'text', ) ); $wp_customize->add_setting( 'twitter_textbox', array( 'sanitize_callback' => 'esc_url_raw', 'default' => '', ) ); $wp_customize->add_control( 'twitter_textbox', array( 'label' => 'Twitter', 'section' => 'footer_section', 'settings' => 'twitter_textbox', 'type' => 'text', ) ); $wp_customize->add_setting( 'googleplus_textbox', array( 'sanitize_callback' => 'esc_url_raw', 'default' => '', ) ); $wp_customize->add_control( 'googleplus_textbox', array( 'label' => 'Googleplus', 'section' => 'footer_section', 'settings' => 'googleplus_textbox', 'type' => 'text', ) ); $wp_customize->add_setting( 'linkedin_textbox', array( 'sanitize_callback' => 'esc_url_raw', 'default' => '', ) ); $wp_customize->add_control( 'linkedin_textbox', array( 'label' => 'Linkedin', 'section' => 'footer_section', 'settings' => 'linkedin_textbox', 'type' => 'text', ) ); $wp_customize->add_setting( 'pinterest_textbox', array( 'sanitize_callback' => 'esc_url_raw', 'default' => '', ) ); $wp_customize->add_control( 'pinterest_textbox', array( 'label' => 'Pinterest', 'section' => 'footer_section', 'settings' => 'pinterest_textbox', 'type' => 'text', ) ); /**********************************************/ /***** ADJUSTMENT OF SIDEBAR POSITION SECTION *****/ /**********************************************/ $wp_customize->add_panel( 'layout', array( 'priority' => 70, 'title' => __( 'Theme Layout', 'blog64' ), 'description' => __( '', 'blog64' ), )); $wp_customize->add_section('sidebar' , array( 'title' => __('Category Sidebar','blog64'), 'panel' => 'layout' )); $wp_customize->add_setting('sidebar_position', array( 'sanitize_callback' => 'blog64_sanitize_text', 'default' => '' )); $wp_customize->add_control('sidebar_position', array( 'label' => __('Category Sidebar position', 'blog64'), 'section' => 'sidebar', 'settings' => 'sidebar_position', 'type' => 'radio', 'choices' => array( 'none' => 'none', 'left' => 'left', 'right' => 'right', ), )); /**********************************************/ /********** SINGLE POST SIDEBAR SECTION ***********/ /**********************************************/ $wp_customize->add_section('single_post_sidebar' , array( 'title' => __('Single Post Sidebar','blog64'), 'panel' => 'layout' )); $wp_customize->add_setting('single_post_sidebar_position', array( 'sanitize_callback' => 'blog64_sanitize_text', 'default' => '' )); $wp_customize->add_control('single_post_sidebar_position', array( 'label' => __('Single Post Sidebar position', 'blog64'), 'section' => 'single_post_sidebar', 'settings' => 'single_post_sidebar_position', 'type' => 'radio', 'choices' => array( 'none' => 'none', 'left' => 'left', 'right' => 'right', ), )); /**********************************************/ /********** SINGLE PAGE SIDEBAR SECTION ***********/ /**********************************************/ $wp_customize->add_section('single_page_sidebar' , array( 'title' => __('Single Page Sidebar','blog64'), 'panel' => 'layout' )); $wp_customize->add_setting('single_page_sidebar_position', array( 'sanitize_callback' => 'blog64_sanitize_text', 'default' => '' )); $wp_customize->add_control('single_page_sidebar_position', array( 'label' => __('Single Page Sidebar position', 'blog64'), 'section' => 'single_page_sidebar', 'settings' => 'single_page_sidebar_position', 'type' => 'radio', 'choices' => array( 'none' => 'none', 'left' => 'left', 'right' => 'right', ), )); /**********************************************/ /******** SEARCH PAGE SIDEBAR SECTION *********/ /**********************************************/ $wp_customize->add_section('search_page_sidebar' , array( 'title' => __('Search Page Sidebar','blog64'), 'panel' => 'layout' )); $wp_customize->add_setting('search_page_sidebar_position', array( 'sanitize_callback' => 'blog64_sanitize_text', 'default' => '' )); $wp_customize->add_control('search_page_sidebar_position', array( 'label' => __('Search Page Sidebar position', 'blog64'), 'section' => 'search_page_sidebar', 'settings' => 'search_page_sidebar_position', 'type' => 'radio', 'choices' => array( 'none' => 'none', 'left' => 'left', 'right' => 'right', ), )); /**********************************************/ /******** PAGE NOT FOUND SIDEBAR SECTION *********/ /**********************************************/ $wp_customize->add_section('page_not_found_sidebar' , array( 'title' => __('Page Not Found Sidebar','blog64'), 'panel' => 'layout' )); $wp_customize->add_setting('page_not_found_sidebar_position', array( 'sanitize_callback' => 'blog64_sanitize_text', 'default' => '' )); $wp_customize->add_control('page_not_found_sidebar_position', array( 'label' => __('Page Not Found Sidebar position', 'blog64'), 'section' => 'page_not_found_sidebar', 'settings' => 'page_not_found_sidebar_position', 'type' => 'radio', 'choices' => array( 'none' => 'none', 'left' => 'left', 'right' => 'right', ), )); } add_action( 'customize_register', 'blog64_customizer_register' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function blog64_customize_preview_js() { wp_enqueue_script( 'blog64_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true ); } add_action( 'customize_preview_init', 'blog64_customize_preview_js' ); function blog64_sanitize_text( $input ) { return wp_kses_post( force_balance_tags( $input ) ); } function blog64_sanitize_textarea( $input ) { return wp_kses_post( force_balance_tags( $input ) ); } function blog64_sanitize_category($input){ $output=intval($input); return $output; }