'_customize-dropdown-categories-' . $this->id, 'echo' => 0, 'show_option_none' => __( '— Select —', 'clickright-lite' ), 'option_none_value' => '0', 'selected' => $this->value(), ) ); // Hackily add in the data link parameter. $dropdown = str_replace( 'get_link(), $dropdown ); printf( '', $this->label, $dropdown ); } } } ////////////////////////////////////////////////////////////////// // Customizer - Add Settings ////////////////////////////////////////////////////////////////// function clickright_lite_register_theme_customizer( $wp_customize ) { // Add Sections $wp_customize->add_section( 'clickright_lite_new_section_color_general' , array( 'title' => 'Colors: General', 'description'=> '', 'priority' => 5, ) ); $wp_customize->add_section( 'clickright_lite_new_section_page' , array( 'title' => 'Page Settings', 'description'=> '', 'priority' => 3, ) ); $wp_customize->add_section( 'clickright_lite_new_section_logo_header' , array( 'title' => 'Site Identity', 'description'=> '', 'priority' => 2, ) ); $wp_customize->add_section( 'clickright_lite_new_section_general' , array( 'title' => 'Site Icon', 'description'=> 'Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. Upload one here! Site Icons should be square and at least 512 . 512 pixels.', 'priority' => 1, ) ); // Add Setting // General //file input sanitization function function theme_slug_sanitize_file( $file, $setting ) { //allowed file types $mimes = array( 'jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png' ); //check file type from file name $file_ext = wp_check_filetype( $file, $mimes ); //if file has a valid mime type return it, otherwise return default return ( $file_ext['ext'] ? $file : $setting->default ); } //checkbox sanitization function function theme_slug_sanitize_checkbox( $input ){ //returns true if checkbox is checked return ( isset( $input ) ? true : false ); } $wp_customize->add_setting( 'clickright-lite_favicon', array( 'sanitize_callback' => 'theme_slug_sanitize_file' ) ); /*$wp_customize->add_setting( 'clickright-lite_home_layout', array( 'default' => 'grid' ) ); $wp_customize->add_setting( 'clickright-lite_archive_layout', array( 'default' => 'grid' ) ); $wp_customize->add_setting( 'clickright-lite_sidebar_home', array( 'default' => true ) ); $wp_customize->add_setting( 'clickright-lite_sidebar_posts', array( 'default' => true ) ); $wp_customize->add_setting( 'clickright-lite_sidebar_archive', array( 'default' => true ) );*/ // Header and logo $wp_customize->add_setting( 'clickright-lite_logo', array( 'sanitize_callback' => 'theme_slug_sanitize_file' ) ); $wp_customize->add_setting( 'clickright-lite_logo_retina', array( 'sanitize_callback' => 'theme_slug_sanitize_file' ) ); // Page Settings $wp_customize->add_setting( 'clickright-lite_page_comments', array( 'default' => false, 'sanitize_callback' => 'theme_slug_sanitize_checkbox' ) ); $wp_customize->add_setting( 'clickright-lite_page_share', array( 'default' => false, 'sanitize_callback' => 'theme_slug_sanitize_checkbox' ) ); // Color Options // Color general $wp_customize->add_setting( 'clickright-lite_color_accent', array( 'default' => '#336699', 'sanitize_callback' => 'sanitize_hex_color' ) ); // Add Control // General $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'upload_favicon', array( 'label' => 'Upload Favicon', 'section' => 'clickright_lite_new_section_general', 'settings' => 'clickright-lite_favicon', 'priority' => 1 ) ) ); // Header and Logo $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'upload_logo', array( 'label' => 'Upload Logo', 'section' => 'clickright_lite_new_section_logo_header', 'settings' => 'clickright-lite_logo', 'priority' => 20 ) ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'upload_logo_retina', array( 'label' => 'Upload Logo (Retina Version)', 'section' => 'clickright_lite_new_section_logo_header', 'settings' => 'clickright-lite_logo_retina', 'priority' => 21 ) ) ); // Page settings $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'page_comments', array( 'label' => 'Hide Comments', 'section' => 'clickright_lite_new_section_page', 'settings' => 'clickright-lite_page_comments', 'type' => 'checkbox', 'priority' => 1 ) ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'page_share', array( 'label' => 'Hide Share Buttons', 'section' => 'clickright_lite_new_section_page', 'settings' => 'clickright-lite_page_share', 'type' => 'checkbox', 'priority' => 2 ) ) ); // Colors general $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'color_accent', array( 'label' => 'Accent', 'section' => 'clickright_lite_new_section_color_general', 'settings' => 'clickright-lite_color_accent', 'priority' => 1 ) ) ); $wp_customize->add_control( new Customize_CustomCss_Control( $wp_customize, 'custom_css', array( 'label' => 'Custom CSS', 'section' => 'clickright_lite_new_section_custom_css', 'settings' => 'clickright-lite_custom_css', 'type' => 'custom_css', 'priority' => 1 ) ) ); // Remove Sections $wp_customize->remove_section( 'title_tagline'); $wp_customize->remove_section( 'header'); $wp_customize->remove_section( 'nav'); $wp_customize->remove_section( 'static_front_page'); $wp_customize->remove_section( 'colors'); $wp_customize->remove_section( 'background_image'); } add_action( 'customize_register', 'clickright_lite_register_theme_customizer' ); ?>