/** * Flush the fragments connected to a post id * * @param unknown $post_ID */ function flush_post_fragment($post_ID) { $page_slug = $this->get_page_slug($post_ID); $urls = Util_PageUrls::get_post_urls($post_ID); $hooks = array('genesis_loop', 'genesis_comments', 'genesis_pings'); foreach ($hooks as $hook) { $genesis_id = $page_slug; $genesis_id = "{$hook}_{$genesis_id}"; w3tc_fragmentcache_flush_fragment($genesis_id, $this->_genesis_group('loop_single_logged_in')); w3tc_fragmentcache_flush_fragment($genesis_id, $this->_genesis_group('loop_single')); for ($page = 0; $page <= sizeof($urls); $page++) { $genesis_id = $page_slug; $genesis_id .= $this->get_paged_page_key($page); $genesis_id = "{$hook}_{$genesis_id}"; w3tc_fragmentcache_flush_fragment($genesis_id, $this->_genesis_group('loop_single_logged_in')); w3tc_fragmentcache_flush_fragment($genesis_id, $this->_genesis_group('loop_single')); } } }
/** * Flush the fragments connected to a post id * @param $post_ID */ function flush_post_fragment($post_ID) { /** * @var W3_SharedPageUrls $W3_SharedPageUrls */ $W3_SharedPageUrls = w3_instance('W3_SharedPageUrls'); $urls = $W3_SharedPageUrls->get_post_urls($post_ID); $hooks = array('genesis_loop', 'genesis_comments', 'genesis_pings'); foreach ($hooks as $hook) { w3tc_fragmentcache_flush_fragment("{$post_ID}_{$hook}", $this->_genesis_group('loop_single_logged_in')); w3tc_fragmentcache_flush_fragment("{$post_ID}_{$hook}", $this->_genesis_group('loop_single')); for ($page = 0; $page <= sizeof($urls); $page++) { w3tc_fragmentcache_flush_fragment("{$post_ID}_{$hook}", $this->_genesis_group('loop_single_logged_in')); w3tc_fragmentcache_flush_fragment("{$post_ID}_{$hook}", $this->_genesis_group('loop_single')); } } }