Make WordPress Core


Ignore:
Timestamp:
03/01/2016 10:17:20 PM (9 years ago)
Author:
westonruter
Message:

Customize: Use selective refresh to preview changes to site title and tagline in core themes.

Fixes issue where wptexturize and other filters fail to apply when previewing changes via postMessage transport.

See #27355.
Fixes #33738.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyeleven/inc/theme-options.php

    r32314 r36797  
    511511    $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
    512512
     513    if ( isset( $wp_customize->selective_refresh ) ) {
     514        $wp_customize->selective_refresh->add_partial( 'blogname', array(
     515            'selector' => '#site-title a',
     516            'container_inclusive' => false,
     517            'render_callback' => 'twentyeleven_customize_partial_blogname',
     518        ) );
     519        $wp_customize->selective_refresh->add_partial( 'blogdescription', array(
     520            'selector' => '#site-description',
     521            'container_inclusive' => false,
     522            'render_callback' => 'twentyeleven_customize_partial_blogdescription',
     523        ) );
     524    }
     525
    513526    $options  = twentyeleven_get_theme_options();
    514527    $defaults = twentyeleven_get_default_theme_options();
     
    576589
    577590/**
     591 * Render the site title for the selective refresh partial.
     592 *
     593 * @since Twenty Eleven 2.4
     594 * @see twentyeleven_customize_register()
     595 *
     596 * @return void
     597 */
     598function twentyeleven_customize_partial_blogname() {
     599    bloginfo( 'name' );
     600}
     601
     602/**
     603 * Render the site tagline for the selective refresh partial.
     604 *
     605 * @since Twenty Eleven 2.4
     606 * @see twentyeleven_customize_register()
     607 *
     608 * @return void
     609 */
     610function twentyeleven_customize_partial_blogdescription() {
     611    bloginfo( 'description' );
     612}
     613
     614/**
    578615 * Bind JS handlers to make Customizer preview reload changes asynchronously.
    579616 *
Note: See TracChangeset for help on using the changeset viewer.