WP Manifestindependent plugin directory
manifest / performance / fcpostcontenthandler

Post Content Handler for Fragment Cache

Cache content for selected posts in singular view. Based upon Fragment Cache by Andrey "Rarst" Savchenko, can work as an extension of that plugin or in standalone mode.

by Giuseppe Mazzapica · github.com/gmazzap/fcpostcontenthandler · website

4stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/gmazzap/fcpostcontenthandler/archive/refs/heads/master.zip

Readme

Post Content Handler for Fragment Cache

Post Content Handler for Fragment Cache is an extension of the awesome WordPress plugin "Fragment Cache" by Andrey "Rarst" Savchenko.

Fragment Cache allows partial and async caching of heavy front-end elements. It currently supports caching navigation menus, widgets, and galleries.

Post Content Handler for Fragment Cache (PCHFC) adds an additional "cache handler" to allow caching of post content in singular views.

PCHFC was realized for a client site, where a premium theme forced to build page content using an insane number of nested shortcodes, ending up in a quite slow page loading.

Full-page caching was not an option, because in that site there are (outside of post content) a lot of user-specific stuff.

Thanks to Fragment Cache I was able to code this handler that allowed me to successfully cache post content, without affecting the rest of the page.

Of course, posts having simple, text only content should not be cached, otherwise page loading time increase instead of decrease: for this reason the plugin add a metabox in the post edit screen where is possible to enable or disable the post content caching.

Post edit screen metabox

A client requirement was that metabox should be only visible to users with specific capability. So I added a setting page (accessible from Settings -> Fragment Cache) where is possible to change the capability required to view the metabox and enable or disable post content fragment caching.

Settings for Post Content Handler for Fragment Cache

As you can see in the screenshot, another option is available: the possibility to choose for which post types the post content caching should be available. When custom post types are registered, they are also visible and selectable in that setting, but unselected by default.

Standalone Mode

As said, PCHFC is just an extension of Fragment Cache, however, even if that plugin is not installed and activated in WordPress, thanks to Fragment Cache Composer support, a copy of the plugin is "embedded" in Post Content Handler folder and so PCHFC can work in "standalone" mode: i.e. you can install PCHFC without having to install Fragment Cache.

When Fragment Cache is installed, it enables the 3 core handlers:

  • Menu
  • Widget
  • Gallery

and they can only disabled via code. See docs for more info.

When in standalone mode, PCHFC adds an additional setting that allow to enable / disable the 3 core handlers.

Settings for Post Content Core Handlers

Requirements

Installation

PCHFC is a Composer package and can be installed in plugin directory via:

composer create-project gmazzap/fc-post-content-handler --no-dev

Gotchas

PCHFC is in development and largely experimental. It has been tested in a very limited amount of conditions and sites. I suggest to test it in a staging / development environment before using it in production.

License

Post Content Handler for Fragment Cache is released under GPLv2+, just like Fragment Cache. Please refers to Fragment Cache readme for license of 3rd parties code required by Fragment Cache.

Read the full README on GitHub →

Releases

TagPublished
2.0.0 Oct 30, 2014
1.0 Aug 25, 2014

These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.