Make WordPress Core

Ticket #38513: 38513.diff

File 38513.diff, 2.0 KB (added by celloexpressions, 8 years ago)

Add selective refresh to the site title and tagline, based on Twenty Fifteen.

  • src/wp-content/themes/twentyseventeen/inc/customizer.php

     
    1717        $wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
    1818        $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
    1919
     20        $wp_customize->selective_refresh->add_partial( 'blogname', array(
     21                'selector' => '.site-title a',
     22                'render_callback' => 'twentyseventeen_customize_partial_blogname',
     23        ) );
     24        $wp_customize->selective_refresh->add_partial( 'blogdescription', array(
     25                'selector' => '.site-description',
     26                'render_callback' => 'twentyseventeen_customize_partial_blogdescription',
     27        ) );
     28
    2029        /**
    2130         * Custom colors.
    2231         */
     
    190199}
    191200
    192201/**
     202 * Render the site title for the selective refresh partial.
     203 *
     204 * @since Twenty Seventeen 1.0
     205 * @see twentyseventeen_customize_register()
     206 *
     207 * @return void
     208 */
     209function twentyseventeen_customize_partial_blogname() {
     210        bloginfo( 'name' );
     211}
     212
     213/**
     214 * Render the site tagline for the selective refresh partial.
     215 *
     216 * @since Twenty Seventeen 1.0
     217 * @see twentyseventeen_customize_register()
     218 *
     219 * @return void
     220 */
     221function twentyseventeen_customize_partial_blogdescription() {
     222        bloginfo( 'description' );
     223}
     224
     225/**
    193226 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
    194227 */
    195228function twentyseventeen_customize_preview_js() {
  • src/wp-content/themes/twentyseventeen/style.css

     
    15571557.site-title,
    15581558.site-title a {
    15591559        color: #222;
     1560        opacity: 1; /* Prevent opacity from changing during selective refreshes in the customize preview */
    15601561}
    15611562
    15621563body.has-header-image .site-title,