>
Download This Plugin | |
Download Elegant Themes | |
Name | Customize Partial Refresh |
Version | 0.1 |
Author | XWP, Weston Ruter |
Rating | 0 |
Last updated | 2014-12-16 11:04:00 |
Downloads |
51
|
Download Plugins Speed Test plugin for Wordpress |
Home page PageSpeed score has been degraded by 0%, while Post page PageSpeed score has been degraded by 0%
Customize Partial Refresh plugin added 9 bytes of resources to the Home page and 26 bytes of resources to the sample Post page.
Customize Partial Refresh plugin added 0 new host(s) to the Home page and 0 new host(s) to the sample Post page.
Great! Customize Partial Refresh plugin ads no tables to your Wordpress blog database.The WordPress Customizer is a framework for previewing any change to a site.
By default, settings exposed in the Customizer use a refresh
transport,
meaning that in order for a setting change to be applied, the entire preview
has to reload. The result is a preview that is anything but live. To remedy this
poor user experience of a laggy preview, the Customizer allows settings to opt-in
to using a postMessage
transport. This relies on JavaScript to apply the changes
live without doing any server-side communication at all: changes are applied
instantly.
There is a major issue with settings using the postMessage
transport,
however: any logic used in PHP to render the setting in the template has to be
duplicated in JavaScript. Thus the transport is not DRY, and so it is really only
suitable for simple text or style changes that involve almost no logic, and this
is commonplace in themes.
What the Customizer needs is a middle-ground between refreshing the entire preview to apply changes with PHP and applying the changes exclusively with JavaScript. The partial preview refresh is one solution, and is proposed in #27355.
Partial preview refreshing was first explored when Customizer widget management was being developed for the 3.9 release. It was added to the Widget Customizer plugin, and described in a Make Core post. But we decided to remove the feature in favor of having a better generalized framework for partial refreshes in a future release.
This plugin first focuses on resurrecting partial preview refreshes for widgets. We can then explore adding partial refresh support to other object types, such as menus, inline styles, or arbitrary regions registered.
To opt-in to partial preview refreshes for a theme, add:
add_theme_support( 'customize-partial-refresh-widgets' );
When this is done, widgets in Core will automatically use partial refreshes. To opt-in to partial refreshes for other widget types, use this to opt-in for a specific widget:
add_filter( "customize_widget_partial_refreshable_{$id_base}", '__return_true' );
And use this to opt-in everything:
add_filter( 'customize_widget_partial_refreshable', '__return_true' );