Make WordPress Core


Ignore:
Timestamp:
10/26/2016 06:42:44 PM (8 years ago)
Author:
davidakennedy
Message:

Twenty Seventeen: Implement selective refresh for site title and tagline

Adding the opacity property to the site title prevents opacity from changing during selective refreshes in the Customizer preview.

Props celloexpressions.

Fixes #38513.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyseventeen/inc/customizer.php

    r38931 r38966  
    1717    $wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
    1818    $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
     19
     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    ) );
    1928
    2029    /**
     
    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 */
Note: See TracChangeset for help on using the changeset viewer.