add_panel( 'begro_header_panel', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Header', 'begro'), ) ); // Site Identity replace to Logos $wp_customize->add_section( 'title_tagline' , array( 'title' => "Logo", 'priority' => 20, // priority set 'panel' => 'begro_header_panel', ) ); $wp_customize->add_setting('logo_id',array( 'default-image' => get_template_directory_uri() . '/assest/imgs/featureProducts/product1.png', 'transport' => 'refresh', 'height' => 180, 'width' => 160, 'type' => 'theme_mod', // or 'option' 'capability' => 'edit_theme_options', 'sanitize_callback' =>'sanitize_text' )); $wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, 'logo', array( 'label' => esc_html__( 'Logo', 'begro' ), 'priority' => 22, // Within the section. 'description' =>'', 'section' => 'title_tagline', 'mime_type' => 'image', 'settings' => 'logo_id', ) ) ); // add Setting Logo - logo_height $wp_customize->add_setting('logo_height', array( 'default' => '', // Set default value for this setting 'capability' => 'edit_theme_options', 'sanitize_callback' =>'sanitize_text' )); /* add control Logo - Desktop logo Height */ $wp_customize->add_control('logo_height', array( 'type' => 'text', 'priority' => 30, // Within the section. 'section' => 'title_tagline', // Required, core or custom. 'label' => esc_html__( 'Desktop: Logo Height', 'begro' ), 'description' => '2em or 80px or 100%', 'input_attrs' => array('class' => '','style' => '', 'placeholder' => esc_html__( '80px', 'begro' ), ), 'settings' => 'logo_height', // Connect form field setting section )); // add Setting Logo - Mobile logo_height $wp_customize->add_setting('mlogo_height', array( 'default' => '', // Set default value for this setting 'capability' => 'edit_theme_options', 'sanitize_callback' =>'sanitize_text' )); /* add control Logo - Mobile logo Height */ $wp_customize->add_control('mlogo_height', array( 'type' => 'text', 'priority' => 30, // Within the section. 'section' => 'title_tagline', // Required, core or custom. 'label' => esc_html__( 'Mobile: Logo Height', 'begro' ), 'description' => '2em or 80px or 100%', 'input_attrs' => array('class' => '','style' => '', 'placeholder' => esc_html__( '60px', 'begro' ), ), 'settings' => 'mlogo_height', // Connect form field setting section )); } /* sanitize function text*/ function sanitize_text($title) { return htmlspecialchars($title); } function sanitize_select( $input, $setting ) { // Ensure input is a slug. $input = sanitize_key( $input ); // Get list of choices from the control associated with the setting. $choices = $setting->manager->get_control( $setting->id )->choices; // If the input is a valid key, return it; otherwise, return the default. return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); }