Changes between Initial Version and Version 1 of Ticket #35982, comment 1
- Timestamp:
- 07/28/2016 08:22:23 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #35982, comment 1
initial v1 1 This sounds an issue related to Selective Refresh (#27355), where the site logo gets rendered with PHP filters applied after an initial purely JS preview. I haven't been able to reproduce the issue with the entire preview not refreshing in Twenty Sixteen. Note that in Core, the ` site_logo` setting is already added with `postMessage`:1 This sounds an issue related to Selective Refresh (#27355), where the site logo gets rendered with PHP filters applied after an initial purely JS preview. I haven't been able to reproduce the issue with the entire preview not refreshing in Twenty Sixteen. Note that in Core, the `custom_logo` setting is already added with `postMessage`: 2 2 3 3 {{{#!php 4 4 <?php 5 $this->add_setting( ' site_logo', array(6 'theme_supports' => array( ' site-logo' ),5 $this->add_setting( 'custom_logo', array( 6 'theme_supports' => array( 'custom-logo' ), 7 7 'transport' => 'postMessage', 8 8 ) ); 9 9 }}} 10 10 11 Is your site logo including the ` site-logo-link` CSS class name as is output by `get_the_site_logo()`? Selective refresh will be looking for an element with this class. Here is how the `site_logo` partial is registered in `WP_Customize_Manager::register_controls()`:11 Is your site logo including the `custom-logo-link` CSS class name as is output by `get_custom_logo()`? Selective refresh will be looking for an element with this class. Here is how the `custom_logo` partial is registered in `WP_Customize_Manager::register_controls()`: 12 12 13 13 {{{#!php 14 14 <?php 15 $this->selective_refresh->add_partial( ' site_logo', array(16 'settings' => array( ' site_logo' ),17 'selector' => '. site-logo-link',18 'render_callback' => array( $this, '_render_ site_logo_partial' ),15 $this->selective_refresh->add_partial( 'custom_logo', array( 16 'settings' => array( 'custom_logo' ), 17 'selector' => '.custom-logo-link', 18 'render_callback' => array( $this, '_render_custom_logo_partial' ), 19 19 'container_inclusive' => true, 20 20 ) ); … … 25 25 Two options I see for you to try: 26 26 27 1) Adjust the selector to match what your theme is actually using if you have modified the output of `get_ the_site_logo`:27 1) Adjust the selector to match what your theme is actually using if you have modified the output of `get_custom_logo`: 28 28 29 29 {{{#!php 30 30 <?php 31 31 add_action( 'customize_register', function( $wp_customize ) { 32 $new_selector = '.my- site-logo';33 $wp_customize->selective_refresh->get_partial( ' site_logo' )->selector = $new_selector;32 $new_selector = '.my-custom-logo'; 33 $wp_customize->selective_refresh->get_partial( 'custom_logo' )->selector = $new_selector; 34 34 }, 20 ); 35 35 }}} … … 40 40 <?php 41 41 add_action( 'customize_register', function( $wp_customize ) { 42 $wp_customize->selective_refresh->get_partial( ' site_logo' )->fallback_refresh = false;42 $wp_customize->selective_refresh->get_partial( 'custom_logo' )->fallback_refresh = false; 43 43 }, 20 ); 44 44 }}}