get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'blog_center_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'blog_center_customize_partial_blogdescription', ) ); } // Header text display setting. $wp_customize->add_setting( 'blog_center_header_text_display', array( 'default' => true, 'sanitize_callback' => 'blog_center_sanitize_checkbox', ) ); $wp_customize->add_control( 'blog_center_header_text_display', array( 'section' => 'title_tagline', 'type' => 'checkbox', 'label' => esc_html__( 'Display Site Title and Tagline', 'blog-center' ), ) ); // Site identity extra options. $wp_customize->add_setting( 'blog_center_site_identity_extra_options', array( 'default' => 'show-all', 'sanitize_callback' => 'blog_center_sanitize_select', ) ); $wp_customize->add_control( 'blog_center_site_identity_extra_options', array( 'priority' => 50, 'type' => 'radio', 'label' => esc_html__( 'Site Identity Extra Options', 'blog-center' ), 'section' => 'title_tagline', 'choices' => array( 'hide-all' => esc_html__( 'Hide All', 'blog-center' ), 'show-all' => esc_html__( 'Show All', 'blog-center' ), 'title-only' => esc_html__( 'Title Only', 'blog-center' ), 'tagline-only' => esc_html__( 'Tagline Only', 'blog-center' ), 'logo-title' => esc_html__( 'Logo + Title', 'blog-center' ), 'logo-tagline' => esc_html__( 'Logo + Tagline', 'blog-center' ), ), ) ); // Color Customizer Setting. require get_template_directory() . '/inc/customizer/color.php'; // frontpage customizer section. require get_template_directory() . '/inc/customizer/frontpage-customizer/customizer-sections.php'; // theme options customizer section. require get_template_directory() . '/inc/customizer/theme-options/theme-options-sections.php'; } add_action( 'customize_register', 'blog_center_customize_register' ); // Sanitize callback. require get_template_directory() . '/inc/customizer/sanitize-callback.php'; /** * Render the site title for the selective refresh partial. * * @return void */ function blog_center_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function blog_center_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function blog_center_customize_preview_js() { wp_enqueue_script( 'blog-center-customizer', get_template_directory_uri() . '/assets/js/customizer.js', array( 'customize-preview' ), BLOG_CENTER_VERSION, true ); } add_action( 'customize_preview_init', 'blog_center_customize_preview_js' ); /** * Binds JS handlers for Customizer controls. */ function blog_center_customize_control_js() { wp_enqueue_style( 'blog-center-customize-style', get_template_directory_uri() . '/assets/css/customize-controls.css', array(), '20151215' ); wp_enqueue_script( 'blog-center-customize-control', get_template_directory_uri() . '/assets/js/customize-control.js', array( 'jquery', 'customize-controls' ), '20151215', true ); $localized_data = array( 'refresh_msg' => esc_html__( 'Refresh the page after Save and Publish.', 'blog-center' ), 'reset_msg' => esc_html__( 'Warning!!! This will reset all the settings. Refresh the page after Save and Publish to reset all.', 'blog-center' ), ); wp_localize_script( 'blog-center-customize-control', 'localized_data', $localized_data ); } add_action( 'customize_controls_enqueue_scripts', 'blog_center_customize_control_js' );