choices)) {
return;
}
$name = '_customize-radio-' . $this->id;
?>
label); ?>
description)) : ?>
description); ?>
add_panel('general_layouts', array(
'title' => esc_html__('General Layouts', 'camaraderie'),
'priority' => 10,
));
/*
========================================================================================================================
Enable and activate General Layouts for camaraderie. The General Layout should only be used
under Posts, Pages, and Archives.
========================================================================================================================
*/
$wp_customize->add_section('global_layout', array(
'title' => esc_html__('General Layout', 'camaraderie'),
'panel' => 'general_layouts',
'priority' => 5,
));
$wp_customize->add_setting('global_layout', array(
'default' => 'no-sidebar',
'sanitize_callback' => 'camaraderie_sanitize_layout',
'transport' => 'refresh',
'type' => 'theme_mod',
));
$wp_customize->add_control(new Camaraderie_Control_Radio_Image($wp_customize, 'global_layout', array(
'label' => esc_html__('General Layout', 'camaraderie'),
'description' => esc_html__('General Layout applies to all layouts that supports in this theme.', 'camaraderie'),
'section' => 'global_layout',
'settings' => 'global_layout',
'type' => 'radio-image',
'choices' => array(
'no-sidebar' => get_theme_file_uri('/framework/assets/images/1col.png'),
'left-sidebar' => get_theme_file_uri('/framework/assets/images/2cl.png'),
'right-sidebar' => get_theme_file_uri('/framework/assets/images/2cr.png'),
),
)));
/*
========================================================================================================================
Enable and activate Custom Layout for camaraderie. The Custom Layout should only be used
under Custom Templates that is registered as part of the theme.
========================================================================================================================
*/
$wp_customize->add_section('custom_layout', array(
'title' => esc_html__('Custom Layout', 'camaraderie'),
'panel' => 'general_layouts',
'priority' => 5,
));
$wp_customize->add_setting('custom_layout', array(
'default' => 'no-sidebar',
'sanitize_callback' => 'camaraderie_sanitize_layout',
'transport' => 'refresh',
'type' => 'theme_mod',
));
$wp_customize->add_control(new Camaraderie_Control_Radio_Image($wp_customize, 'custom_layout', array(
'label' => esc_html__('Custom Layout', 'camaraderie'),
'description' => esc_html__('Custom Layout applies to all layouts that supports in this theme.', 'camaraderie'),
'section' => 'custom_layout',
'settings' => 'custom_layout',
'type' => 'radio-image',
'choices' => array(
'no-sidebar' => get_theme_file_uri('/framework/assets/images/1col.png'),
'left-sidebar' => get_theme_file_uri('/framework/assets/images/2cl.png'),
'right-sidebar' => get_theme_file_uri('/framework/assets/images/2cr.png'),
),
)));
/*
========================================================================================================================
Enable and activate Portfolio Layout for camaraderie. The Portfolio Layout should only be used
under Custom Templates that is registered as part of the theme.
========================================================================================================================
*/
$wp_customize->add_section('portfolio_layout', array(
'title' => esc_html__('Portfolio Layout', 'camaraderie'),
'panel' => 'general_layouts',
'priority' => 5,
));
$wp_customize->add_setting('portfolio_layout', array(
'default' => 'no-sidebar',
'sanitize_callback' => 'camaraderie_sanitize_layout',
'transport' => 'refresh',
'type' => 'theme_mod',
));
$wp_customize->add_control(new Camaraderie_Control_Radio_Image($wp_customize, 'portfolio_layout', array(
'label' => esc_html__('Portfolio Layout', 'camaraderie'),
'description' => esc_html__('Portfolio Layout applies to all layouts that supports in this theme.', 'camaraderie'),
'section' => 'portfolio_layout',
'settings' => 'portfolio_layout',
'type' => 'radio-image',
'choices' => array(
'no-sidebar' => get_theme_file_uri('/framework/assets/images/1col.png'),
'left-sidebar' => get_theme_file_uri('/framework/assets/images/2cl.png'),
'right-sidebar' => get_theme_file_uri('/framework/assets/images/2cr.png'),
),
)));
}
add_action('customize_register', 'camaraderie_control_radio_image_layout_setup');
/*
============================================================================================================================
3.0 - Control Radio Image (Validation)
============================================================================================================================
*/
function camaraderie_sanitize_layout($value) {
if (!in_array($value, array('left-sidebar', 'right-sidebar', 'no-sidebar'))) {
$value = 'no-sidebar';
}
return $value;
}