add_panel( 'header', array( 'priority' => 2, 'title' => esc_html( __( 'Header', 'smerk' ) ), 'description' => esc_html( __( 'My Description', 'smerk' ) ), 'icon' => 'dashicons-admin-site', ) ); // Header Section $wp_customize->add_section( 'header_general', array( 'title' => esc_html( __( 'General', 'smerk' ) ), 'panel' => 'header', 'priority' => 211, 'icon' => 'dashicons-admin-tools', ) ); $wp_customize->add_section( 'header_logo', array( 'title' => esc_html( __( 'Logo', 'smerk' ) ), 'panel' => 'header', 'priority' => 212, 'icon' => 'dashicons-lightbulb', ) ); $wp_customize->add_section( 'header_search', array( 'title' => esc_html( __( 'Search', 'smerk' ) ), 'panel' => 'header', 'priority' => 213, 'icon' => 'dashicons-search', ) ); $wp_customize->add_section( 'header_banner', array( 'title' => esc_html( __( 'Banner', 'smerk' ) ), 'panel' => 'header', 'priority' => 214, 'icon' => 'dashicons-search', ) ); $wp_customize->add_section( 'social_header', array( 'title' => esc_html( __( 'Social', 'smerk' ) ), 'panel' => 'header', 'priority' => 215, 'icon' => 'dashicons-format-aside', ) ); $wp_customize->add_section( 'header_mini_cart', array( 'title' => esc_html( __( 'Mini cart', 'smerk' ) ), 'panel' => 'header', 'priority' => 216, 'icon' => 'dashicons-cart', ) ); //Header Setting $wp_customize->add_setting( 'hd_type' , array( 'default' => 'header2', 'transport' => 'refresh', 'sanitize_callback' => 'header_sanitize' ) ); $wp_customize->add_setting( 'hd_ba' , array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_setting( 'hd_lg' , array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_setting('hd_lg_he', array( 'default' => '90px', 'transport' => 'refresh',' sanitize_callback' => 'bookish_sanitize_text' )); $wp_customize->add_setting('hd_lg_wd', array( 'default' => '224px', 'transport' => 'refresh',' sanitize_callback' => 'bookish_sanitize_text' )); $wp_customize->add_setting( 'hd_soc' , array( 'default' => 'true', 'transport' => 'refresh', 'sanitize_callback' => 'smerk_sanitize_checkbox' ) ); $wp_customize->add_setting( 'hd_ink' , array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_setting( 'hd_twi' , array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_setting( 'hd_fac' , array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_setting( 'hd_gog' , array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'esc_url_raw' ) ); // Header Control $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'hd_type', array( 'label' => __( 'Select The Header Type', 'smerk' ), 'type' => 'select', 'help' => esc_html( __( 'Setup Title text color', 'smerk' ) ), 'section' => 'header_general', 'settings' => 'hd_type', 'choices' =>array( 'header1' => 'Header 1', 'header2' => 'Header 2', ) ) ) ); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'banner', array( 'label' => __( 'Upload the Banner Image', 'smerk' ), 'section' => 'header_banner', 'settings' => 'hd_ba', ) ) ); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo', array( 'label' => __( 'Upload a logo', 'smerk' ), 'section' => 'header_logo', 'settings' => 'hd_lg', ) ) ); $wp_customize->add_control(new WP_Customize_Control( $wp_customize,'hd_lg_he', array( 'section' => 'header_logo', 'settings' => 'hd_lg_he', 'label' => 'Height', 'type' => 'text', ))); $wp_customize->add_control(new WP_Customize_Control( $wp_customize,'hd_lg_wd', array( 'section' => 'header_logo', 'settings' => 'hd_lg_wd', 'label' => 'Width', 'type' => 'text', ))); $wp_customize->add_control('hd_soc', array( 'type' => 'checkbox', 'label' => 'Social Icons', 'section' => 'social_header', 'settings' => 'hd_soc' ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'hd_ink', array( 'type' => 'text', 'label' => __( 'LinkedIn', 'smerk' ), 'help' => esc_html( __( 'Enter the LinkedIn ID', 'smerk' ) ), 'section' => 'social_header', 'settings' => 'hd_ink', ) ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'hd_twi', array( 'type' => 'text', 'label' => __( 'Twitter', 'smerk' ), 'help' => esc_html( __( 'Enter the Twitter ID', 'smerk' ) ), 'section' => 'social_header', 'settings' => 'hd_twi', ) ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'hd_fac', array( 'type' => 'text', 'label' => __( 'Facebook', 'smerk' ), 'help' => esc_html( __( 'Enter the Facebook ID', 'smerk' ) ), 'section' => 'social_header', 'settings' => 'hd_fac', ) ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'hd_gog', array( 'type' => 'text', 'label' => __( 'Google+', 'smerk' ), 'help' => esc_html( __( 'Enter the Googleplus ID', 'smerk' ) ), 'section' => 'social_header', 'settings' => 'hd_gog', ) ) ); function header_sanitize( $input ) { $valid = array( 'header1' => 'Header 1', 'header2' => 'Header 2', ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } /** * Checkbox Sanitization Callback * * Sanitization callback for 'checkbox' type controls. * This callback sanitizes $input as a Boolean value, either * TRUE or FALSE. */ function smerk_sanitize_checkbox( $input ) { // Boolean check return ( ( isset( $input ) && true == $input ) ? true : false ); } ?>