Documentation

Everything you need to get started with Blocksy Theme and Companion

Integration with caching plugins

Note: as of Blocksy 1.7.11 this document is deprecated — the Header Builder implementation no longer interferes with caching plugins.

Blocksy’s Header Builder uses two totally separated views for desktop and mobile devices — thus allowing for a greater flexibility. In order to support this, we have to detect which device the user is using for accessing the site. This check is done by looking into the User Agent header of the request, and that’s where issues can start to pop in. It works without any problems on sites that do not have caching enabled, but everyone usually needs that for speed improvements.

Most of the caching plugins ignore the User Agent header and always serve the same cached version of the page. This results in all mobile devices always receiving the desktop’s version of the header (only for a couple of seconds, until the JavaScript kicks in), which is very bad for multiple reasons.

For a plugin/caching solution to work properly with our Header Builder, it needs to have support for branching caching on user agents or specifically for WordPress’s is_mobile() function. A lot of WordPress-focused cache plugins do have this in place but some not.

The proper fix for this would be to enable User Agent Groups matching in your caching solution. Next, we will list how to enable this for most popular cache plugins/solutions:

W3 Total Cache

  1. Go to Performance -> User Agent Groups
  2. You will see two groups created by default tables and phones. Click the checkboxes for both of them in order to enabling caching based on these values.
  3. Click Save Settings & Purge Caches

WP Super Cache

  1. Go to Settings -> WP Super Cache -> Advanced Tab
  2. Enable the Mobile device support checkbox
  3. Remove all the existing caches for the plugin

LiteSpeed Cache

  1. Go to LiteSpeed Cache -> Cache
  2. Enable the Cache Mobile option (Press the ON button)
  3. Purge all the existing caches so that everything gets rebuilt

Swift Performance

  1. Go to Tools -> Swift Performance
  2. Go to the Caching->General tab of their settings
  3. Enable the Separate Mobile Device Cache setting.
  4. Scroll up and click the SAVE CHANGES button. When asked if you want to clear the caches, click the Clear cache button.

WP Fastest Cache

  1. Go to WP Fastest Cache options panel
  2. If you don’t have the Premium version of the plugin — enable Mobile option
  3. If you have the Premium version, though, it’s better to disable the Mobile option and enable Mobile Theme
  4. Scroll down and click the Submit button to save the changes. Also make sure to click the Delete Cache button.

Cache Enabler

The situation with the Cache Enabler plugin is a bit more sad, unfortunately. This plugin doesn’t provide support for user agents grouping at all. When they detect a theme or a plugin that has such behaviour — they simply disable their caching at all when they detect a plugin/theme that uses this technique. Blocksy theme doesn’t bypass their cache for now, in hopes that they will fix it. In order to get proper caching and a functioning header you will have to use another caching solution that support the wp_is_mobile() call, like WP Super Cache.

Another option is to manually disable all of the Cache Enabler cache’s, but then with that in place there’s no reason to keep the plugin around. That can be done by using this filter:

add_filter('bypass_cache', '__return_true');

Again, keep in mind that this will disable all of the caching, turning the plugin useless.

For advanced users: There is a way to get Cache Enabler to work with wp_is_mobile() function, but this involves editing plugin files, which will break the updates for it. More details can be seen in this thread.


Please note:

This post is constantly updated with listings for new caching plugins. Please write to our support in case your’s missing from this article.

Not the solution you are looking for?

Please check other articles or open a support ticket.