Auto updates for WordPress themes and plugins from private GitLab repos

The last few days I worked on the following scenario: a WordPress plugin or theme gets its update from a private GitLab repo and checks the Git tags for a new version. The result is a WordPress plugin, which also can be integrated into a plugin or theme directly.

Continue reading "Auto updates for WordPress themes and plugins from private GitLab repos"

Use selective refresh in the customizer

Since WordPress 4.5, we can reload only parts of the customizer preview after a setting has changed. With that, the user has — at least — the feeling of a faster experience. And in most cases, it will be actually faster (and besides that, this feature could eliminate the customizer page and replace it with inline editing, writes Weston Ruter in his post »Selective Refresh in the Customizer«). Here I show you how to implement selective refresh.

Continue reading "Use selective refresh in the customizer"

Conditional displaying and hiding of customizer controls via JavaScript

When using Partial Refresh in the customizer to reload only a part of the preview after changing a setting’s value, the active_callback for these settings is not working anymore. With active_callback you can, for example, show a control only if another control has a particular value. In that case, the conditional displaying has to be done with JavaScript.

Continue reading "Conditional displaying and hiding of customizer controls via JavaScript"

Kick off reload of customizer preview from the preview

In my Photographus theme, I needed to reload the customizer preview from the preview in a specific case. After searching for a short while, I found the post »Implementing Selective Refresh in the Customizer« by Weston Ruter.

The problem is solved with the following JS line:

wp.customize.preview.send('refresh');
Code language: JavaScript (javascript)