WordPress.org

Make WordPress Core

Changes between Version 1 and Version 3 of Ticket #36582


Ignore:
Timestamp:
04/23/2016 11:36:21 PM (4 years ago)
Author:
westonruter
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36582 – Description

    v1 v3  
    33An initial implementation of this has been implemented in the Customize Posts feature plugin: https://github.com/xwp/wp-customize-posts
    44
     5When the preview syncs the `WP_Query` data from the preview to the pane, the data should get sent along with the `ready` message along with the `activeControls`, `activeSections`, and `activePanels` data. When the data is received by the pane, it should get populated into a model which can have events attached to it. For example, a `wp.customize.Values` instance could be used as a collection to represent the query_vars. Or there could be one single `wp.customize.Value` that stores the exported `WP_Query` data in like `wp.customize.previewedQuery` which plugins could then listen to changes on. For example:
     6
     7{{{#!js
     8wp.customize.previewedQuery.bind( function( newQuery, oldQuery ) {
     9    if ( newQuery.is_singular !== oldQuery.is_singular ) {
     10        if ( newQuery.is_singular ) {
     11            // We switched to a singular template!
     12        } else {
     13            // We switched to a non-singular template!
     14        }
     15    }
     16} );
     17}}}
     18
     19Some thought will need to be given to how a JavaScript object is used to represent `WP_Query`.
     20
    521See Slack: https://wordpress.slack.com/archives/core-customize/p1461011732000103