get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->remove_section( 'header_textcolor'); $wp_customize->remove_section( 'colors'); $wp_customize->remove_section( 'header_image'); $wp_customize->remove_section( 'background_image'); } add_action( 'customize_register', 'flatter_customize_register' ); function flatter_customizer_register( $wp_customize ) { // Do stuff with $wp_customize, the WP_Customize_Manager object. $wp_customize->add_panel( 'theme_option', array( 'priority' => 40, 'title' => __( 'Flatter Theme Option', 'flatter' ), 'description' => __( 'Welcome to Flatter Theme Option.', 'flatter' ), )); /**********************************************/ /*************** LOGO SECTION *****************/ /**********************************************/ $wp_customize->add_section('theme_logo',array( 'priority' => 40, 'title' => __('Theme Logo','flatter'), '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' => get_template_directory_uri().'/images/logo.png' )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize,'logo_image',array( 'label' => __('Edit Theme Logo','flatter'), 'section' => 'theme_logo', 'settings' => 'logo_image' ) )); /**********************************************/ /************* MAIN SLIDER SECTION *************/ /**********************************************/ $wp_customize->add_section('slider_category',array( 'title' => __('Slider Categories','flatter'), 'description' => 'Select the Slide Category for Homepage.', 'panel' => 'theme_option' )); $wp_customize->add_setting('slider_category_display',array( 'sanitize_callback' => 'flatter_sanitize_category', 'default' => '' )); $wp_customize->add_control(new flatter_Customize_Dropdown_Taxonomies_Control($wp_customize,'slider_category_display',array( 'label' => __('Choose category','flatter'), 'section' => 'slider_category', 'settings' => 'slider_category_display', 'type'=> 'dropdown-taxonomies', ) )); $wp_customize->add_setting( 'slider_button', array( 'sanitize_callback' => 'esc_url_raw', 'default' => 'http://oceanwebthemes.com', ) ); $wp_customize->add_control( 'slider_button', array( 'label' => 'Welcome Button Link', 'section' => 'slider_category', 'settings' => 'slider_button', 'type' => 'text', ) ); /**********************************************/ /************* FEATURES SECTION *************/ /**********************************************/ $wp_customize->add_section('features_category',array( 'title' => __('Features Categories','flatter'), 'description' => 'Select the Features Category for Homepage.', 'panel' => 'theme_option' )); $wp_customize->add_setting('features_category_display',array( 'sanitize_callback' => 'flatter_sanitize_category', 'default' => '' )); $wp_customize->add_control(new flatter_Customize_Dropdown_Taxonomies_Control($wp_customize,'features_category_display',array( 'label' => __('Choose category','flatter'), 'section' => 'features_category', 'settings' => 'features_category_display', 'type'=> 'dropdown-taxonomies', ) )); /**********************************************/ /************* SERVICES SECTION *************/ /**********************************************/ $wp_customize->add_section('services_category',array( 'title' => __('Services Categories','flatter'), 'description' => 'Select the Services Category for Homepage.', 'panel' => 'theme_option' )); $wp_customize->add_setting( 'services_title', array( 'sanitize_callback' => 'flatter_sanitize_text', 'default' => 'Our Services', ) ); $wp_customize->add_control( 'services_title', array( 'label' => 'Our Services Title', 'section' => 'services_category', 'settings' => 'services_title', 'type' => 'text', ) ); $wp_customize->add_setting('services_category_display',array( 'sanitize_callback' => 'flatter_sanitize_category', 'default' => '' )); $wp_customize->add_control(new flatter_Customize_Dropdown_Taxonomies_Control($wp_customize,'services_category_display',array( 'label' => __('Choose category','flatter'), 'section' => 'services_category', 'settings' => 'services_category_display', 'type'=> 'dropdown-taxonomies', ) )); /**********************************************/ /************* TESTIMONIALS SECTION *************/ /**********************************************/ $wp_customize->add_section('testimonial_category',array( 'title' => __('Testimonials Categories','flatter'), 'description' => 'Select the Testimonials Category for Homepage.', 'panel' => 'theme_option' )); $wp_customize->add_setting( 'testimonial_title', array( 'sanitize_callback' => 'flatter_sanitize_text', 'default' => 'Testimonials', ) ); $wp_customize->add_control( 'testimonial_title', array( 'label' => 'Testimonials Title', 'section' => 'testimonial_category', 'settings' => 'testimonial_title', 'type' => 'text', ) ); $wp_customize->add_setting('testimonial_category_display',array( 'sanitize_callback' => 'flatter_sanitize_category', 'default' => '' )); $wp_customize->add_control(new flatter_Customize_Dropdown_Taxonomies_Control($wp_customize,'testimonial_category_display',array( 'label' => __('Choose category','flatter'), 'section' => 'testimonial_category', 'settings' => 'testimonial_category_display', 'type'=> 'dropdown-taxonomies', ) )); /**********************************************/ /************* LATEST POST SECTION *************/ /**********************************************/ $wp_customize->add_section('latestpost_category',array( 'title' => __('Latest Post Categories','flatter'), 'description' => 'Select the Latest Post Category for Homepage.', 'panel' => 'theme_option' )); $wp_customize->add_setting( 'latestpost_title', array( 'sanitize_callback' => 'flatter_sanitize_text', 'default' => 'Latest Post', ) ); $wp_customize->add_control( 'latestpost_title', array( 'label' => 'Latest Post Title', 'section' => 'latestpost_category', 'settings' => 'latestpost_title', 'type' => 'text', ) ); $wp_customize->add_setting('latestpost_category_display',array( 'sanitize_callback' => 'flatter_sanitize_category', 'default' => '' )); $wp_customize->add_control(new flatter_Customize_Dropdown_Taxonomies_Control($wp_customize,'latestpost_category_display',array( 'label' => __('Choose category','flatter'), 'section' => 'latestpost_category', 'settings' => 'latestpost_category_display', 'type'=> 'dropdown-taxonomies', ) )); /**********************************************/ /************* OUR WORKS SECTION *************/ /**********************************************/ $wp_customize->add_section('ourworks_category',array( 'title' => __('Our Works Categories','flatter'), 'description' => 'Select the Our Works Category for Homepage.', 'panel' => 'theme_option' )); $wp_customize->add_setting( 'ourworks_title', array( 'sanitize_callback' => 'flatter_sanitize_text', 'default' => 'Our Works', ) ); $wp_customize->add_control( 'ourworks_title', array( 'label' => 'Our Works Title', 'section' => 'ourworks_category', 'settings' => 'ourworks_title', 'type' => 'text', ) ); $wp_customize->add_setting('ourworks_category_display',array( 'sanitize_callback' => 'flatter_sanitize_category', 'default' => '' )); $wp_customize->add_control(new flatter_Customize_Dropdown_Taxonomies_Control($wp_customize,'ourworks_category_display',array( 'label' => __('Choose category','flatter'), 'section' => 'ourworks_category', 'settings' => 'ourworks_category_display', 'type'=> 'dropdown-taxonomies', ) )); /**********************************************/ /*************** NEWSLETTER SECTION ***************/ /**********************************************/ $wp_customize->add_section('newsletter_text',array( 'title' => __('Newsletter Section','flatter'), 'description' => 'Write Some Words for Newsletter Section in Homepage', 'panel' => 'theme_option' )); $wp_customize->add_setting( 'newsletter_textbox', array( 'sanitize_callback' => 'flatter_sanitize_text', 'default' => 'Subscribe for newsletter', ) ); $wp_customize->add_control( 'newsletter_textbox', array( 'label' => 'Newsletter Textbox', 'section' => 'newsletter_text', 'settings' => 'newsletter_textbox', 'type' => 'text', ) ); /**********************************************/ /*************** FOOTER SECTION ***************/ /**********************************************/ $wp_customize->add_section( 'footer_section', array( 'title' => 'Footer Settings', 'description' => 'Customize your Footer section.', 'panel' => 'theme_option' ) ); /**********************************************/ /*************** COPYRIGHTS SECTION **************/ /**********************************************/ $wp_customize->add_setting( 'copyright_textbox', array( 'sanitize_callback' => 'flatter_sanitize_text', 'default' => '© 2015. FLATTER. All Rights Reserved.', ) ); $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('socialicon_display',array( 'sanitize_callback' => 'flatter_sanitize_text', 'default' => '' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize,'socialicon_display',array( 'label' => __('Show social icons','flatter'), 'section' => 'footer_section', 'settings' => '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( 'youtube_textbox', array( 'sanitize_callback' => 'esc_url_raw', 'default' => '', ) ); $wp_customize->add_control( 'youtube_textbox', array( 'label' => 'You Tube', 'section' => 'footer_section', 'settings' => 'youtube_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', ) ); /**********************************************/ /***** ENABLE / DISABLE RTL MODE SECTION *****/ /**********************************************/ $wp_customize->add_section( 'rtl_section', array( 'title' => 'Enable RTL Mode?', 'description' => 'Check to Enable RTL Mode.', 'panel' => 'theme_option' ) ); $wp_customize->add_setting( 'rtl_display', array( 'sanitize_callback' => 'flatter_sanitize_text')); $wp_customize->add_control( 'rtl_display', array( 'type' => 'checkbox', 'label' => __('Enable RTL Mode?','flatter'), 'section' => 'rtl_section', 'priority' => 50, ) ); /**********************************************/ /***** ADJUSTMENT OF SIDEBAR POSITION SECTION *****/ /**********************************************/ $wp_customize->add_panel( 'layout', array( 'priority' => 45, 'title' => __( 'Flatter Sidebar Layout', 'flatter' ), 'description' => __( 'Theme Sidebar Layout', 'flatter' ), )); $wp_customize->add_section('sidebar' , array( 'title' => __('Category Sidebar','flatter'), 'panel' => 'layout' )); $wp_customize->add_setting('sidebar_position', array( 'sanitize_callback' => 'flatter_sanitize_text', 'default' => 'left' )); $wp_customize->add_control('sidebar_position', array( 'label' => __('Sidebar position', 'flatter'), 'section' => 'sidebar', 'settings' => 'sidebar_position', 'type' => 'radio', 'choices' => array( 'both' => 'both', 'left' => 'left', 'right' => 'right', ), )); /**********************************************/ /********** SINGLE POST SIDEBAR SECTION ***********/ /**********************************************/ $wp_customize->add_section('single_post_sidebar' , array( 'title' => __('Single Post Sidebar','flatter'), 'panel' => 'layout' )); $wp_customize->add_setting('single_post_sidebar_position', array( 'sanitize_callback' => 'flatter_sanitize_text', 'default' => 'left' )); $wp_customize->add_control('single_post_sidebar_position', array( 'label' => __('Single Post Sidebar position', 'flatter'), 'section' => 'single_post_sidebar', 'settings' => 'single_post_sidebar_position', 'type' => 'radio', 'choices' => array( 'both' => 'both', 'left' => 'left', 'right' => 'right', ), )); /**********************************************/ /********** SINGLE PAGE SIDEBAR SECTION ***********/ /**********************************************/ $wp_customize->add_section('single_page_sidebar' , array( 'title' => __('Single Page Sidebar','flatter'), 'panel' => 'layout' )); $wp_customize->add_setting('single_page_sidebar_position', array( 'sanitize_callback' => 'flatter_sanitize_text', 'default' => 'left' )); $wp_customize->add_control('single_page_sidebar_position', array( 'label' => __('Single Page Sidebar position', 'flatter'), 'section' => 'single_page_sidebar', 'settings' => 'single_page_sidebar_position', 'type' => 'radio', 'choices' => array( 'both' => 'both', 'left' => 'left', 'right' => 'right', ), )); /**********************************************/ /******** SEARCH PAGE SIDEBAR SECTION *********/ /**********************************************/ $wp_customize->add_section('search_page_sidebar' , array( 'title' => __('Search Page Sidebar','flatter'), 'panel' => 'layout' )); $wp_customize->add_setting('search_page_sidebar_position', array( 'sanitize_callback' => 'flatter_sanitize_text', 'default' => 'left' )); $wp_customize->add_control('search_page_sidebar_position', array( 'label' => __('Search Page Sidebar position', 'flatter'), 'section' => 'search_page_sidebar', 'settings' => 'search_page_sidebar_position', 'type' => 'radio', 'choices' => array( 'both' => 'both', 'left' => 'left', 'right' => 'right', ), )); /**********************************************/ /******** PAGE NOT FOUND SIDEBAR SECTION *********/ /**********************************************/ $wp_customize->add_section('page_not_found_sidebar' , array( 'title' => __('Page Not Found Sidebar','flatter'), 'panel' => 'layout' )); $wp_customize->add_setting('page_not_found_sidebar_position', array( 'sanitize_callback' => 'flatter_sanitize_text', 'default' => 'left' )); $wp_customize->add_control('page_not_found_sidebar_position', array( 'label' => __('Page Not Found Sidebar position', 'flatter'), 'section' => 'page_not_found_sidebar', 'settings' => 'page_not_found_sidebar_position', 'type' => 'radio', 'choices' => array( 'both' => 'both', 'left' => 'left', 'right' => 'right', ), )); } add_action( 'customize_register', 'flatter_customizer_register' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function flatter_customize_preview_js() { wp_enqueue_script( 'flatter_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true ); } add_action( 'customize_preview_init', 'flatter_customize_preview_js' ); function flatter_sanitize_text( $input ) { return wp_kses_post( force_balance_tags( $input ) ); } function flatter_sanitize_textarea( $input ) { return wp_kses_post( force_balance_tags( $input ) ); } function flatter_sanitize_category($input){ $output=intval($input); return $output; }