[wp-trac] [WordPress Trac] #31320: Make customizer JavaScript API available during the live preview

WordPress Trac noreply at wordpress.org
Sun Feb 28 05:17:07 UTC 2016


#31320: Make customizer JavaScript API available during the live preview
-------------------------+-------------------------
 Reporter:  Fab1en       |       Owner:
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:  4.5
Component:  Customize    |     Version:  4.1
 Severity:  normal       |  Resolution:  fixed
 Keywords:               |     Focuses:  javascript
-------------------------+-------------------------

Comment (by westonruter):

 @sidati I think you should take a different approach, to listen for when
 the relevant section is added, and then act appropriately. Though I'm not
 totally sure about what you're looking to accomplish, here's an example
 this code added to the pane:

 {{{#!js
 wp.customize.previewer.bind( 'disable-sidebar', function( sidebarId ) {
     // The following code will execute once the section exists.
     wp.customize.section( 'sidebar-widgets-' + sidebarId, function(
 section ) {
         section.active.set( false );
     } );
 } );
 }}}

 This wouldn't depend on any `ready` event. Just send the `disable-sidebar`
 message after the preview is `active`. Alternatively, you can do this also
 from PHP at a lower level, by filtering `customize_section_active`.

 In any case, I suggest you continue any further discussion via the
 WordPress support forums, the [http://wordpress.stackexchange.com/ WP
 stack exchange], or create a new ticket if there turns out to be an issue
 with the Customizer platform. Thanks.

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


More information about the wp-trac mailing list