You appear to be a bot. Output may be restricted
Description
Add postMessage support for site title and description for the Customizer.
Usage
twentyfifteen_customize_register( $wp_customize );
Parameters
- $wp_customize
- ( WP_Customize_Manager ) required – Customizer object.
Returns
void
Source
File name: twentyfifteen/inc/customizer.php
Lines:
1 to 96 of 96
function twentyfifteen_customize_register( $wp_customize ) { $color_scheme = twentyfifteen_get_color_scheme(); $wp_customize->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', 'container_inclusive' => false, 'render_callback' => 'twentyfifteen_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'container_inclusive' => false, 'render_callback' => 'twentyfifteen_customize_partial_blogdescription', ) ); } // Add color scheme setting and control. $wp_customize->add_setting( 'color_scheme', array( 'default' => 'default', 'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'color_scheme', array( 'label' => __( 'Base Color Scheme', 'twentyfifteen' ), 'section' => 'colors', 'type' => 'select', 'choices' => twentyfifteen_get_color_scheme_choices(), 'priority' => 1, ) ); // Add custom header and sidebar text color setting and control. $wp_customize->add_setting( 'sidebar_textcolor', array( 'default' => $color_scheme[4], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'sidebar_textcolor', array( 'label' => __( 'Header and Sidebar Text Color', 'twentyfifteen' ), 'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ), 'section' => 'colors', ) ) ); // Remove the core header textcolor control, as it shares the sidebar text color. $wp_customize->remove_control( 'header_textcolor' ); // Add custom header and sidebar background color setting and control. $wp_customize->add_setting( 'header_background_color', array( 'default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_background_color', array( 'label' => __( 'Header and Sidebar Background Color', 'twentyfifteen' ), 'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ), 'section' => 'colors', ) ) ); // Add an additional description to the header image section. $wp_customize->get_section( 'header_image' )->description = __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ); }