Since there is no purging and you want to people to be able to comment it is recommended to use a hosted commenting software, such as FaceBook Comments or Disqus. If you do not use this comments are not shown after they been posted or approved.
Main step to get CloudFront full page caching working is to have your site on a different domain than the one you want your visitors to see. So you should install or configure your site so its on a separate domain, for example wp.example.com. You will then later configure example.com so its used by CloudFront.
How to configure CloudFront on AWS:
Configure DNS
How to configure W3 Total Cache:
There are two methods to configure W3 Total Cache CDN. Origin Pull "CloudFront" or "Generic mirror". If you want to be able to invalidate URLs from within WordPress you need to use the CloudFront option. If you do not configure an CDN the wrong URLs will be used when linking to CSS, JS and other files.
Configure CloudFront:
Configure Generic Mirror:
If you have anything dynamic in your widgets area, the sidebar, then you'll need to disable the sidebar caching, or enter pages that should not have their sidedar cached.
]]>To make the plugin aware that you group transients see code examples below:
add_action('w3tc_register_fragment_groups', 'my_plugin_register_groups'); function my_plugin_register_groups() { //blog specific group and an array of actions that will trigger a flush of the group w3tc_register_fragment_group('my_plugin_', array('publish_post'), 3600); //If using MultiSite Network/site wide specific group and an array of actions that will trigger a flush of the group w3tc_register_fragment_group_global('my_plugin_global_', array('edit_site'), 3600); } function my_plugin_flush_group() { //manually flush group. w3tc_fragmentcache_flush_group('my_plugin_'); } //Set transients function on_some_event() { if (false === get_transient('my_plugin_some_key')) //my_plugin_ prefix is the group name we registered earlier set_transient('my_plugin_some_key', 'blog specific value'); if (false === get_site_transient('my_plugin_some_key')) //my_plugin_site_ prefix is the group name we registered earlier set_site_transient('my_plugin_site_some_key', 'site wide specific value'); } // Cache action example add_action('theme_post_loop', 'cache_theme_post_loop_start',-999999999); add_action('theme_post_loop', 'cache_theme_post_loop_end', 999999999); /** * Start outputbuffering */ function cache_theme_post_loop_start() { w3tc_fragmentcache_start('example1', 'examples', 'theme_post_loop'); } /** * Store the output buffer . */ function cache_theme_post_loop_end() { w3tc_fragmentcache_end('example1', 'examples', false); } // Cache filter example add_filter('theme_filter', 'cache_theme_filter_start',-999999999); add_filter('theme_filter', 'cache_theme_filter_end', 999999999); /** * Start filter buffering and return filter result */ function cache_theme_filter_start($data) { return w3tc_fragmentcache_filter_start('example_filter1', 'examples', $hook, $data); } /** * Store the filter result and return filter result. */ function cache_theme_filter_end($data) { return w3tc_fragmentcache_filter_end('example_filter1', 'examples', $data); }]]>