default ); } function generpress_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 ); } /** * Add postMessage support for site title and description for the Theme Customizer. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function generpress_customize_register( $wp_customize ) { $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; /** |------------------------------------------------------------------------------- | Panel: General Options |------------------------------------------------------------------------------- | */ require_once get_template_directory() . '/inc/customizer/options-general.php'; /** |------------------------------------------------------------------------------- | Panel: Single Options |------------------------------------------------------------------------------- | */ require_once get_template_directory() . '/inc/customizer/options-single.php'; /** |------------------------------------------------------------------------------- | Panel: Slideshow Options |------------------------------------------------------------------------------- | */ //require_once get_template_directory() . '/inc/customizer/options-header.php'; /** |------------------------------------------------------------------------------- | Function: Refresh In Customizer Options |------------------------------------------------------------------------------- | */ if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'generpress_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'generpress_customize_partial_blogdescription', ) ); } } add_action( 'customize_register', 'generpress_customize_register' );