[wp-trac] [WordPress Trac] #42049: Customize Themes: extensibility improvements
WordPress Trac
noreply at wordpress.org
Sun Oct 1 02:46:09 UTC 2017
#42049: Customize Themes: extensibility improvements
------------------------------+--------------------
Reporter: celloexpressions | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.9
Component: Customize | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
------------------------------+--------------------
Changes (by celloexpressions):
* keywords: needs-patch => has-patch
Comment:
In [attachment:42049.diff]:
- Introduce `WP_Customize_Themes_Section::filter_type`, which has built-in
functionality for `local` and `remote` filtering. When this set to
`local`, all themes are assumed to be loaded from Ajax when the section is
first loaded, and subsequent searching/filtering is applied to the loaded
collection of themes within the section. This is how the core "Installed"
section behaves - third-party sources with limited numbers of themes may
consider leveraging this implementation. When this is set to `remote`,
searching and filtering always triggers a new remote query via Ajax. The
core "WordPress.org" section uses this approach, as it has over 5000
themes to search.
- Refactor `filterSearch()` to accept a raw term string as input. This
enables a feature filter to be used on a section where `filter_type` is
`local`.
- Refactor `filter()` on a theme control to check for an array of terms.
Also sort the results by the number of matches. Rather than searching for
an exact match, this will now search for each word in a search distinctly,
allowing things like tags to rank in search results more accurately.
- Split `loadControls()` into two functions for themes section JS:
`loadThemes()` to initiate and manage an Ajax request and `loadControls()`
to create theme controls based on the results of the Ajax call. If third-
party sections need to change the way controls are loaded, such as by
using a custom control subclass of `WP_Customize_Theme_Control`, this
allows them to use the core logic for managing the Ajax call and only
override the actual control-creation process.
- Introduce `customize_load_themes_ajax` filter to facilitate loading
themes from third-party sources (or modifying the results of the core
sections).
In addition to making it easier for third-party sources to leverage the
core functionality here, this now brings significant improvements to the
installed themes search filter. I don't have anything else planned for
this ticket - the next step is to engage with theme marketplaces and
encourage them to start building plugins to integrate here (Jetpack is
probably a good starting point?), reporting any issues they find.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42049#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list