get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; } add_action( 'customize_register', 'thecompany_customize_register' ); add_action('after_setup_theme','twentyelevenchild_customize_appearance_header_options'); function twentyelevenchild_customize_appearance_header_options () { add_theme_support( 'custom-logo', array( 'height' => 45, 'width' => 200, 'flex-height' => true, 'flex-width' => true, ) ); } add_action( 'after_setup_theme','remove_color_options', 100 ); function remove_color_options() { remove_theme_support( 'custom-background' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function thecompany_customize_preview_js() { wp_enqueue_script( 'thecompany_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'thecompany_customize_preview_js' ); function thecompany_theme_customizer_register( $wp_customize ) { // Do stuff with $wp_customize, the WP_Customize_Manager object. /** Default Settings */ $wp_customize->add_panel( 'wp_default_panel', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Default Settings', 'thecompany' ), 'description' => __( 'Default section provided by wordpress customizer.', 'thecompany' ), ) ); $wp_customize->get_section( 'title_tagline' )->panel = 'wp_default_panel'; $wp_customize->get_section( 'colors' )->panel = 'wp_default_panel'; $wp_customize->get_section( 'header_image' )->panel = 'wp_default_panel'; $wp_customize->get_section( 'background_image' )->panel = 'wp_default_panel'; $wp_customize->get_section( 'static_front_page' )->panel = 'wp_default_panel'; $wp_customize->add_panel( 'theme_option', array( 'priority' => 200, 'title' => __( 'Theme Option', 'thecompany' ), 'description' => __( 'Hosting-one Theme Option', 'thecompany' ), )); /**********************************************/ /************* MAIN SLIDER SECTION *************/ /**********************************************/ $wp_customize->add_section('main_slider_category',array( 'priority' => 20, 'title' => __('Slider Section','thecompany'), 'description' => __('Select the Slide Category for Homepage.','thecompany'), 'panel' => 'theme_option', )); $wp_customize->add_setting('slider_category_display',array( 'default' => '1', 'sanitize_callback' => 'thecompany_sanitize_category', )); $wp_customize->add_control(new thecompany_theme_Customize_Dropdown_Taxonomies_Control($wp_customize,'slider_category_display',array( 'label' => __('Choose category','thecompany'), 'section' => 'main_slider_category', 'settings' => 'slider_category_display', 'type'=> 'dropdown-taxonomies', ) )); // enable/disable slider $wp_customize->add_setting( 'slider_disable', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'thecompany_sanitize_checkbox', 'default' =>'1', ) ); $wp_customize->add_control( 'slider_disable', array( 'label' => __( 'Check to disable Slider', 'thecompany' ), 'section' => 'main_slider_category', 'settings' => 'slider_disable', 'type' => 'radio', 'choices' => array( '0' => __('Disable','thecompany' ), '1' => __('Enable','thecompany' ), ), ) ); // no of posts to show on slider $wp_customize->add_setting( 'slider_no_of_posts', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'thecompany_sanitize_text', 'default' => '5', ) ); $wp_customize->add_control( 'slider_no_of_posts', array( 'settings' => 'slider_no_of_posts', 'label' => __( 'No Of Posts To Show On Slider', 'thecompany' ), 'section' => 'main_slider_category', 'type' => 'select', 'choices' => array( '1' => __( '1', 'thecompany' ), '2' => __( '2 ', 'thecompany' ), '3' => __( '3', 'thecompany' ), '4' => __( '4', 'thecompany' ), '5' => __( '5', 'thecompany' ), '6' => __( '6', 'thecompany' ), '7' => __( '7', 'thecompany' ), '8' => __( '8', 'thecompany' ), '9' => __( '9', 'thecompany' ) ), 'priority' => 20 ) ); // ---------------------search -----------------------------------------//// $wp_customize->add_section('search_section',array( 'priority' => 20, 'title' => __('Search Section ','thecompany'), 'description' => __('','thecompany'), 'panel' => 'theme_option' )); // enable/disable search $wp_customize->add_setting( 'search_disable', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'thecompany_sanitize_checkbox', 'default' =>'1', ) ); $wp_customize->add_control( 'search_disable', array( 'label' => __( 'Check to disable Search', 'thecompany' ), 'section' => 'search_section', 'settings' => 'search_disable', 'type' => 'radio', 'choices' => array( '0' => __('Disable','thecompany' ), '1' => __('Enable','thecompany' ), ), ) ); // search title $wp_customize->add_setting('search_title',array( 'sanitize_callback' => 'thecompany_sanitize_text', 'default'=> __('Search','thecompany'), )); $wp_customize->add_control('search_title',array( 'label' => __('Search Title','thecompany'), 'section' => 'search_section', 'settings' => 'search_title', 'type' => 'text' )); // search placeholder $wp_customize->add_setting('search_placeholder',array( 'sanitize_callback' => 'thecompany_sanitize_text', 'default'=> __('Enter the keyword','thecompany'), )); $wp_customize->add_control('search_placeholder',array( 'label' => __('Search Placeholder','thecompany'), 'section' => 'search_section', 'settings' => 'search_placeholder', 'type' => 'text' )); /// ------------------------------WHY CHOOSE US-------------------------------// $wp_customize->add_section('why_choose_us_category',array( 'priority' => 20, 'title' => __('Why Choose Us Section','thecompany'), 'description' => __('Select the Why Choose Us Category for Homepage.','thecompany'), 'panel' => 'theme_option' )); $wp_customize->add_setting('why_choose_us_category_display',array( 'default' => '1', 'sanitize_callback' => 'thecompany_sanitize_category', )); $wp_customize->add_control(new thecompany_theme_Customize_Dropdown_Taxonomies_Control($wp_customize,'why_choose_us_category_display',array( 'label' => __('Choose category','thecompany'), 'section' => 'why_choose_us_category', 'settings' => 'why_choose_us_category_display', 'type'=> 'dropdown-taxonomies', ) )); // enable/disable why_choose_us $wp_customize->add_setting( 'why_choose_us_disable', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'thecompany_sanitize_checkbox', 'default' =>'1', ) ); $wp_customize->add_control( 'why_choose_us_disable', array( 'label' => __( 'Check to disable Why Choose Us', 'thecompany' ), 'section' => 'why_choose_us_category', 'settings' => 'why_choose_us_disable', 'type' => 'radio', 'choices' => array( '0' => __('Disable','thecompany' ), '1' => __('Enable','thecompany' ), ), ) ); // why choose us title $wp_customize->add_setting('why_choose_us_title',array( 'sanitize_callback' => 'thecompany_sanitize_text', 'default'=> __('Why Choose Us','thecompany'), )); $wp_customize->add_control('why_choose_us_title',array( 'label' => __('Why Choose Us Title','thecompany'), 'section' => 'why_choose_us_category', 'settings' => 'why_choose_us_title', 'type' => 'text' )); // why choose us icon $wp_customize->add_setting('why_choose_us_icon',array( 'sanitize_callback' => 'thecompany_sanitize_text', 'default'=> __('fa fa-headphones','thecompany'), )); $wp_customize->add_control('why_choose_us_icon',array( 'label' => __('Why Choose Us Icon','thecompany'), 'section' => 'why_choose_us_category', 'settings' => 'why_choose_us_icon', 'type' => 'text' )); // no of posts to show on why_choose_us $wp_customize->add_setting( 'why_choose_us_no_of_posts', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'thecompany_sanitize_text', 'default' => '4', ) ); $wp_customize->add_control( 'why_choose_us_no_of_posts', array( 'settings' => 'why_choose_us_no_of_posts', 'label' => __( 'No Of Posts To Show On Why Choose Us', 'thecompany' ), 'section' => 'why_choose_us_category', 'type' => 'select', 'choices' => array( '4' => __( '4', 'thecompany' ), '8' => __( '8 ', 'thecompany' ), '12' => __( '12', 'thecompany' ), '16' => __( '16', 'thecompany' ), ), 'priority' => 20 ) ); /// ------------------------------OVERVIEW-------------------------------// $wp_customize->add_section('overview_category',array( 'priority' => 20, 'title' => __('Overview Section','thecompany'), 'description' => __('Select the Overview Category for Homepage.','thecompany'), 'panel' => 'theme_option' )); // enable/disable overview $wp_customize->add_setting( 'overview_disable', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'thecompany_sanitize_checkbox', 'default' =>'1', ) ); $wp_customize->add_control( 'overview_disable', array( 'label' => __( 'Check to disable Overview', 'thecompany' ), 'section' => 'overview_category', 'settings' => 'overview_disable', 'type' => 'radio', 'choices' => array( '0' => __('Disable','thecompany' ), '1' => __('Enable','thecompany' ), ), ) ); // why choose us title $wp_customize->add_setting('overview_title',array( 'sanitize_callback' => 'thecompany_sanitize_text', 'default'=> __('An Overview','thecompany'), )); $wp_customize->add_control('overview_title',array( 'label' => __('Overview Heading Title','thecompany'), 'section' => 'overview_category', 'settings' => 'overview_title', 'type' => 'text' )); // counter for ( $i = 1; $i <= 4; $i++ ) { $wp_customize->add_setting('overview_counter'.$i,array( 'sanitize_callback' => 'thecompany_sanitize_text', 'default'=> '6756'.$i, )); $wp_customize->add_control('overview_counter'.$i,array( 'label' => __('Overview Counter' ,'thecompany').$i, 'section' => 'overview_category', 'settings' => 'overview_counter'.$i, 'type' => 'text' )); $wp_customize->add_setting('overview_title'.$i,array( 'sanitize_callback' => 'thecompany_sanitize_text', 'default'=> 'Title'.$i, )); $wp_customize->add_control('overview_title'.$i,array( 'label' => __('Overview Title' ,'thecompany').$i, 'section' => 'overview_category', 'settings' => 'overview_title'.$i, 'type' => 'text' )); $wp_customize->add_setting('overview_subtitle'.$i,array( 'sanitize_callback' => 'thecompany_sanitize_text', 'default'=> 'SubTitle'.$i, )); $wp_customize->add_control('overview_subtitle'.$i,array( 'label' => __('Overview Sub Title' ,'thecompany').$i, 'section' => 'overview_category', 'settings' => 'overview_subtitle'.$i, 'type' => 'text' )); } $wp_customize->add_setting( 'default_image_setting', array( 'capability' => 'edit_theme_options', 'default' => '', 'sanitize_callback' => 'thecompany_sanitize_image' ) ); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'default_image_setting', array( 'label' => __('Upload Overview Background Image ', 'thecompany'), 'section' => 'overview_category', 'setting' => 'default_image_setting', 'priority' => 20 ))); /// ------------------------------WHAT WE OFFER-------------------------------// $wp_customize->add_section('offer_category',array( 'priority' => 20, 'title' => __('What We Offer Section','thecompany'), 'description' => __('Select the What We Offer Category for Homepage.','thecompany'), 'panel' => 'theme_option' )); $wp_customize->add_setting('offer_category_display',array( 'default' => '1', 'sanitize_callback' => 'thecompany_sanitize_category', )); $wp_customize->add_control(new thecompany_theme_Customize_Dropdown_Taxonomies_Control($wp_customize,'offer_category_display',array( 'label' => __('Choose category','thecompany'), 'section' => 'offer_category', 'settings' => 'offer_category_display', 'type'=> 'dropdown-taxonomies', ) )); // enable/disable offer $wp_customize->add_setting( 'offer_disable', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'thecompany_sanitize_checkbox', 'default' =>'1', ) ); $wp_customize->add_control( 'offer_disable', array( 'label' => __( 'Check to disable What We Offer', 'thecompany' ), 'section' => 'offer_category', 'settings' => 'offer_disable', 'type' => 'radio', 'choices' => array( '0' => __('Disable','thecompany' ), '1' => __('Enable','thecompany' ), ), ) ); // why choose us title $wp_customize->add_setting('offer_title',array( 'sanitize_callback' => 'thecompany_sanitize_text', 'default'=> __('What We Offer','thecompany'), )); $wp_customize->add_control('offer_title',array( 'label' => __('What We Offer Title','thecompany'), 'section' => 'offer_category', 'settings' => 'offer_title', 'type' => 'text' )); // no of posts to show on offer $wp_customize->add_setting( 'offer_no_of_posts', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'thecompany_sanitize_text', 'default' => '3', ) ); $wp_customize->add_control( 'offer_no_of_posts', array( 'settings' => 'offer_no_of_posts', 'label' => __( 'No Of Posts To Show On What We Offer', 'thecompany' ), 'section' => 'offer_category', 'type' => 'select', 'choices' => array( '3' => __( '3', 'thecompany' ), '6' => __( '6 ', 'thecompany' ), '9' => __( '9', 'thecompany' ), '12' => __( '12', 'thecompany' ), ), 'priority' => 20 ) ); /// ------------------------------WHAT WE OFFER-------------------------------// $wp_customize->add_section('pricing_category',array( 'priority' => 20, 'title' => __('Pricing Table','thecompany'), 'description' => __('Add Pricing Widget To Home Sidebar','thecompany'), 'panel' => 'theme_option' )); // why choose us title $wp_customize->add_setting('pricing_title',array( 'sanitize_callback' => 'thecompany_sanitize_text', 'default'=> __('Pricing Table','thecompany'), )); $wp_customize->add_control('pricing_title',array( 'label' => __('What We Offer Title','thecompany'), 'section' => 'pricing_category', 'settings' => 'pricing_title', 'type' => 'text' )); // why choose us title $wp_customize->add_setting('pricing_Content',array( 'sanitize_callback' => 'thecompany_sanitize_text', 'default'=> __('Quisque et nisl id magna feugiat euismod efficitur ut nisi.','thecompany'), )); $wp_customize->add_control('pricing_Content',array( 'label' => __('What We Offer Title','thecompany'), 'section' => 'pricing_category', 'settings' => 'pricing_Content', 'type' => 'text' )); /////-----------------------LAYOUT OPTION--------------------// $wp_customize->add_section('sidebar' , array( 'priority' => 20, 'title' => __(' Sidebar','thecompany'), 'panel' => 'theme_option' )); $wp_customize->add_setting('sidebar_position_archive', array( 'sanitize_callback' => 'thecompany_sanitize_sidebar', 'default' => 'right', )); $wp_customize->add_control('sidebar_position_archive', array( 'label' => __('Archive Sidebar position ', 'thecompany'), 'section' => 'sidebar', 'settings' => 'sidebar_position_archive', 'type' => 'radio', 'choices' => array( 'none' => __('none','thecompany'), 'left' => __('left','thecompany'), 'right' => __('right','thecompany'), ), )); $wp_customize->add_setting('sidebar_position_category', array( 'sanitize_callback' => 'thecompany_sanitize_sidebar', 'default' => 'right', )); $wp_customize->add_control('sidebar_position_category', array( 'label' => __('Category Sidebar position', 'thecompany'), 'section' => 'sidebar', 'settings' => 'sidebar_position_category', 'type' => 'radio', 'choices' => array( 'none' => __('none','thecompany'), 'left' => __('left','thecompany'), 'right' => __('right','thecompany'), ), )); $wp_customize->add_setting('sidebar_position_404', array( 'sanitize_callback' => 'thecompany_sanitize_sidebar', 'default' => 'right', )); $wp_customize->add_control('sidebar_position_404', array( 'label' => __('404 Error Sidebar position', 'thecompany'), 'section' => 'sidebar', 'settings' => 'sidebar_position_404', 'type' => 'radio', 'choices' => array( 'none' => __('none','thecompany'), 'left' => __('left','thecompany'), 'right' => __('right','thecompany'), ), )); $wp_customize->add_setting('sidebar_position_page', array( 'sanitize_callback' => 'thecompany_sanitize_sidebar', 'default' => 'right', )); $wp_customize->add_control('sidebar_position_page', array( 'label' => __('Page Sidebar position', 'thecompany'), 'section' => 'sidebar', 'settings' => 'sidebar_position_page', 'type' => 'radio', 'choices' => array( 'none' => __('none','thecompany'), 'left' => __('left','thecompany'), 'right' => __('right','thecompany'), ), )); $wp_customize->add_setting('sidebar_position_search', array( 'sanitize_callback' => 'thecompany_sanitize_sidebar', 'default' => 'right', )); $wp_customize->add_control('sidebar_position_search', array( 'label' => __('Search Page Sidebar position', 'thecompany'), 'section' => 'sidebar', 'settings' => 'sidebar_position_search', 'type' => 'radio', 'choices' => array( 'none' => __('none','thecompany'), 'left' => __('left','thecompany'), 'right' => __('right','thecompany'), ), )); $wp_customize->add_setting('sidebar_position_single', array( 'sanitize_callback' => 'thecompany_sanitize_sidebar', 'default' => 'right', )); $wp_customize->add_control('sidebar_position_single', array( 'label' => __('Single Post Sidebar position', 'thecompany'), 'section' => 'sidebar', 'settings' => 'sidebar_position_single', 'type' => 'radio', 'choices' => array( 'none' => __('none','thecompany'), 'left' => __('left','thecompany'), 'right' => __('right','thecompany'), ), )); // custom code $wp_customize->add_section( 'thecompany_custom', array( 'description' =>__( 'Here are some custom code options that can be added from this section.', 'thecompany' ), 'capability' => 'edit_theme_options', 'priority' => 20, 'title' => __( 'Hosting One Custom Code Options', 'thecompany' ), 'panel' => 'theme_option', ) ); //****** custom css $wp_customize->add_setting( 'thecompany_customcss_setting', array( 'capability' => 'edit_theme_options', 'default' => '', 'sanitize_callback' => 'thecompany_sanitize_text' ) ); $wp_customize->add_control( 'thecompany_customcss_setting', array( 'settings' => 'thecompany_customcss_setting', 'label' => __( 'Enter Custom CSS', 'thecompany' ), 'section' => 'thecompany_custom', 'type' => 'textarea', 'priority' => 20 ) ); // ********** header code $wp_customize->add_setting( 'thecompany_headercode_setting', array( 'capability' => 'edit_theme_options', 'default' => '', 'sanitize_callback' => 'thecompany_sanitize_text' ) ); $wp_customize->add_control( 'thecompany_headercode_setting', array( 'settings' => 'thecompany_headercode_setting', 'label' => __( 'Paste Header Code', 'thecompany' ), 'section' => 'thecompany_custom', 'type' => 'textarea', 'priority' => 20 ) ); // ******************footer code $wp_customize->add_setting( 'thecompany_footercode_setting', array( 'capability' => 'edit_theme_options', 'default' => '', 'sanitize_callback' => 'thecompany_sanitize_text' ) ); $wp_customize->add_control( 'thecompany_footercode_setting', array( 'settings' => 'thecompany_footercode_setting', 'label' => __( 'Paste Footer Code', 'thecompany' ), 'section' => 'thecompany_custom', 'type' => 'textarea', 'priority' => 20 ) ); $wp_customize->add_section( 'thecompany_other', array( 'description' =>__( 'Other Options', 'thecompany' ), 'capability' => 'edit_theme_options', 'priority' => 20, 'title' => __( 'Other Option', 'thecompany' ), 'panel' => 'theme_option', ) ); $wp_customize->add_setting( 'thecompany_excerpt_setting', array( 'capability' => 'edit_theme_options', 'default' => '20', 'sanitize_callback' => 'thecompany_sanitize_text', ) ); $wp_customize->add_control( 'thecompany_excerpt_setting', array( 'description' => __('Excerpt length. Default is 40 words', 'thecompany'), 'input_attrs' => array( 'min' => 10, 'max' => 200, 'step' => 5, 'style' => 'width: 60px;' ), 'label' => __( 'Excerpt Length (words)', 'thecompany' ), 'section' => 'thecompany_other', 'settings' => 'thecompany_excerpt_setting', 'type' => 'number', ) ); $wp_customize->add_setting( 'thecompany_scrollup_setting', array( 'capability' => 'edit_theme_options', 'default' => '', 'sanitize_callback' => 'thecompany_sanitize_checkbox', ) ); $wp_customize->add_control( 'thecompany_scrollup_setting', array( 'label' => __( 'Check to disable Scroll Up', 'thecompany' ), 'section' => 'thecompany_other', 'settings' => 'thecompany_scrollup_setting', 'type' => 'checkbox', ) ); $wp_customize->add_setting( 'thecompany_copyright_setting', array( 'capability' => 'edit_theme_options', 'default' => '', 'sanitize_callback' => 'thecompany_sanitize_text' ) ); $wp_customize->add_control( 'thecompany_copyright_setting', array( 'settings' => 'thecompany_copyright_setting', 'label' => __( 'Wite Copyright Text', 'thecompany' ), 'section' => 'thecompany_other', 'type' => 'text', 'priority' => 20 ) ); /// -------------------FOOTER SOCIAL ICONS---// $wp_customize->add_section( 'thecompany_footer_social', array( 'description' =>__( 'Paste Your Social Media Links', 'thecompany' ), 'capability' => 'edit_theme_options', 'priority' => 20, 'title' => __( 'Footer Social Media Options', 'thecompany' ), 'panel' => 'theme_option', ) ); $wp_customize->add_setting( 'facebook_textbox', array( 'sanitize_callback' => 'esc_url_raw', 'default' => '#', ) ); $wp_customize->add_control( 'facebook_textbox', array( 'label' => __('Facebook','thecompany'), 'section' => 'thecompany_footer_social', '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','thecompany'), 'section' => 'thecompany_footer_social', 'settings' => 'twitter_textbox', 'type' => 'text', ) ); $wp_customize->add_setting( 'google_plus_textbox', array( 'sanitize_callback' => 'esc_url_raw', 'default' => '#', ) ); $wp_customize->add_control( 'google_plus_textbox', array( 'label' => __('Google Plus','thecompany'), 'section' => 'thecompany_footer_social', 'settings' => 'google_plus_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','thecompany'), 'section' => 'thecompany_footer_social', 'settings' => 'linkedin_textbox', 'type' => 'text', ) ); $wp_customize->add_setting( 'youtube_textbox', array( 'sanitize_callback' => 'esc_url_raw', 'default' => '#', ) ); $wp_customize->add_control( 'youtube_textbox', array( 'label' => __('Youtube','thecompany'), 'section' => 'thecompany_footer_social', 'settings' => 'youtube_textbox', 'type' => 'text', ) ); $wp_customize->add_setting( 'skype_textbox', array( 'sanitize_callback' => 'esc_url_raw', 'default' => '#', ) ); $wp_customize->add_control( 'skype_textbox', array( 'label' => __('Skype','thecompany'), 'section' => 'thecompany_footer_social', 'settings' => 'skype_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','thecompany'), 'section' => 'thecompany_footer_social', 'settings' => 'pinterest_textbox', 'type' => 'text', ) ); $wp_customize->add_setting( 'instagram_textbox', array( 'sanitize_callback' => 'esc_url_raw', 'default' => '#', ) ); $wp_customize->add_control( 'instagram_textbox', array( 'label' => __('Instagram','thecompany'), 'section' => 'thecompany_footer_social', 'settings' => 'instagram_textbox', 'type' => 'text', ) ); } add_action( 'customize_register', 'thecompany_theme_customizer_register' ); /** * Sanitize Input or Textarea. * @param $input * @return string */ function thecompany_sanitize_text( $input ) { return wp_kses_post( force_balance_tags( $input ) ); } /** * Sanitize Checkbox. * @param $input * @return int|string */ function thecompany_sanitize_checkbox( $input ) { if ( $input == 1 ) { return 1; } else { return ''; } } /** * Sanitize Sidebar custom dropdown. * @param $input * @return string */ function thecompany_sanitize_sidebar( $input ) { $valid = array( 'left' => 'Left', 'right' => 'Right', 'none' => 'None', ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } /** * Sanitize Category. * @param $input * @return int */ function thecompany_sanitize_category($input){ $output=intval($input); return $output; } /** * Sanitize image. * @param $input * @return int */ function thecompany_sanitize_image( $thecompany_image, $thecompany_setting ) { /* * Array of valid image file types. * * The array includes image mime types that are included in wp_get_mime_types() */ $complete_mimes = array( 'jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'bmp' => 'image/bmp', 'tif|tiff' => 'image/tiff', 'ico' => 'image/x-icon' ); // Return an array with file extension and mime_type. $thecompany_file = wp_check_filetype( $thecompany_image, $complete_mimes ); // If $thecompany_image has a valid mime_type, return it; otherwise, return the default. return ( $thecompany_file['ext'] ? $thecompany_image : $thecompany_setting->default ); }