get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial(
'blogname',
array(
'selector' => '.site-title a',
'render_callback' => 'caper_customize_partial_blogname',
)
);
$wp_customize->selective_refresh->add_partial(
'blogdescription',
array(
'selector' => '.site-description',
'render_callback' => 'caper_customize_partial_blogdescription',
)
);
}
/***************************
Add Sanitization
***************************/
include get_template_directory() . '/inc/customizer/sanitization/sanitizer.php';
/***************************
Add Panels
***************************/
//Add Theme Customization Panel
$wp_customize->add_panel( 'theme_options', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __('Theme Options', 'caper'),
'description' => '',
) );
//Add General Section
$wp_customize->add_section(
'general',
array(
'title' => __( 'Global Styles', 'caper'),
'panel' => 'theme_options',
'priority' => 30,
'description' => __( 'Customize your global styles in this section', 'caper' )
)
);
//Controls and Settings for Global Section
include get_template_directory() . '/inc/customizer/sections/global.php';
//Add Navbar Section
$wp_customize->add_section(
'navbar',
array(
'title' => __( 'Navbar', 'caper'),
'panel' => 'theme_options',
'priority' => 30,
'description' => __( 'Customize your navbar styles in this section', 'caper' )
)
);
//Controls and Settings for Navbar Section
include get_template_directory() . '/inc/customizer/sections/navbar.php';
//Add Section Breaks Section
$wp_customize->add_section('section_breaks', array(
'title' => __('Section Breaks', 'caper'),
'panel' => 'theme_options',
// 'priority' => 70,
));
//Controls and Settings for Breaks Section
include get_template_directory() . '/inc/customizer/sections/breaks.php';
//Add Custom Page section
$wp_customize->add_section('custom_page', array(
'title' => __(' Custom Page ', 'caper'),
'panel' => 'theme_options',
'priority' => 120,
));
//Controls and Settings for Custom Page Section
include get_template_directory() . '/inc/customizer/sections/custom-page.php';
//Add Post Page section
$wp_customize->add_section('post_page', array(
'title' => __(' Post Page ', 'caper'),
'panel' => 'theme_options',
'priority' => 120,
));
//Controls and Settings for Custom Page Section
include get_template_directory() . '/inc/customizer/sections/post-page.php';
//Add Font section
$wp_customize->add_section('typography', array(
'title' => __(' Typography ', 'caper'),
'panel' => 'theme_options',
'priority' => 120,
));
//Controls and Settings for Typography Section
// Add in future because enqueueing problems need to be solved
// include get_template_directory() . '/inc/customizer/sections/typography.php';
//Add Test section
$wp_customize->add_section('test', array(
'title' => __(' Test ', 'caper'),
'panel' => 'theme_options',
'priority' => 120,
));
//Controls and Settings for Custom Page Section
// include get_template_directory() . '/inc/customizer/sections/test.php';
//Include Settings and Controls for Generic Tabs
include get_template_directory() . '/inc/customizer/sections/colors.php';
include get_template_directory() . '/inc/customizer/sections/header-image.php';
}
add_action( 'customize_register', 'caper_customize_register' );
/**
* Add css for the new color controls in the customizer
*/
function caper_customizer_css()
{
include get_template_directory() . '/inc/customizer/css/generic.php';
include get_template_directory() . '/inc/customizer/css/custom-page.php';
include get_template_directory() . '/inc/customizer/css/post-page.php';
include get_template_directory() . '/inc/customizer/css/global.php';
include get_template_directory() . '/inc/customizer/css/navbar.php';
?>