[wp-trac] [WordPress Trac] #36600: Selective refresh finds selected selector throughout the whole theme/site.

WordPress Trac noreply at wordpress.org
Thu Apr 21 17:53:56 UTC 2016


#36600: Selective refresh finds selected selector throughout the whole theme/site.
-------------------------------+------------------------------
 Reporter:  helloguna1         |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Customize          |     Version:  4.5
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  javascript
-------------------------------+------------------------------

Comment (by westonruter):

 @helloguna1 and it doesn't work in that it causes a full page refresh
 unexpectedly? This would be due to the selector not matching anything and
 so the `fallback_refresh` behavior then kicks in.

 You should only add this partial when this page template is being
 rendered. For example, wrap it in a `is_page_template( 'page-template-
 portfolio.php' )` conditional. Like this:

 {{{#!php
 <?php
 add_action( 'customize_register', function( WP_Customize_Manager
 $wp_customize ) {
         add_action( 'wp', function() use ( $wp_customize ) {
                 if ( is_page_template( 'page-no-sidebars.php' ) ) {
                         $wp_customize->selective_refresh->add_partial(
 'portfolio_page_display_num_items', array( /* ... */ ) );
                 }
         } );
 } );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36600#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list