senswebmedia
6/14/2013 - 5:28 AM

How do I implement page fragment caching

How do I implement page fragment caching

How do I implement page fragment caching?

First you need to define W3TC_DYNAMIC_SECURITY in your wp-config.php file.

define('W3TC_DYNAMIC_SECURITY', 'somesecurestring');
                
Edit your templates with the following syntax to ensure that dynamic features remain so. Replace with content of the constant:

Example 1:
<!-- mfunc {the W3TC_DYNAMIC_SECURITY string} any PHP code --><!-- /mfunc {the W3TC_DYNAMIC_SECURITY string} -->
Example 2:
<!-- mfunc {the W3TC_DYNAMIC_SECURITY string} -->any PHP code<!-- /mfunc {the W3TC_DYNAMIC_SECURITY string} -->
Example 3:
<!--MFUNC {the W3TC_DYNAMIC_SECURITY string}           -->
                                      echo rand();
<!--/mfunc {the W3TC_DYNAMIC_SECURITY string} -->
Example 4:
<!-- mclude {the W3TC_DYNAMIC_SECURITY string} path/to/file.php --><!-- /mclude {the W3TC_DYNAMIC_SECURITY string} -->
Example 5:
<!-- mclude {the W3TC_DYNAMIC_SECURITY string} -->path/to/file.php<!-- /mclude {the W3TC_DYNAMIC_SECURITY string} -->
Be aware that WordPress functions will not be available.