add_section('header_layout_setting', array(
'title' => esc_html__('Header Layout', 'appointment-red'),
'panel' => 'header_options'
));
// Header Layout settings
if ((!has_custom_logo() && $appointment_red_header_settings['enable_header_logo_text'] == 'nomorenow' ) || $appointment_red_header_settings['enable_header_logo_text'] == 1 || $appointment_red_header_settings['upload_image_logo'] != '') {
$wp_customize->add_setting('appointment_options[header_layout_setting]', array(
'default' => 'default',
'sanitize_callback' => 'appointment_red_sanitize_radio',
'type' => 'option'
));
} else {
$wp_customize->add_setting('appointment_options[header_layout_setting]', array(
'default' => 'sticky',
'sanitize_callback' => 'appointment_red_sanitize_radio',
'type' => 'option'
));
}
$wp_customize->add_control(new Appointment_red_Image_Radio_Button_Custom_Control($wp_customize, 'appointment_options[header_layout_setting]',
array(
'label' => esc_html__('Header Layout Setting', 'appointment-red'),
'section' => 'header_layout_setting',
'choices' => array(
'default' => array(
'image' => APPOINTMENT_RED_TEMPLATE_DIR_URI . '/images/appointment-red-header1.png',
'name' => esc_html__('Header Standard', 'appointment-red')
),
'sticky' => array(
'image' => APPOINTMENT_RED_TEMPLATE_DIR_URI . '/images/appointment-red-header2.png',
'name' => esc_html__('Header Overlap', 'appointment-red')
)
)
)
));
}
add_action('customize_register', 'appointment_red_header_layout_customizer');
//radio box sanitization function
function appointment_red_sanitize_radio($input, $setting) {
$input = sanitize_key($input);
$choices = $setting->manager->get_control($setting->id)->choices;
//return if valid
return ( array_key_exists($input, $choices) ? $input : $setting->default );
}