key = $key; } if ($timeout) { $this->timeout = $timeout; } } public function render() { $cache = get_transient($this->key); if ($cache === false || $this->enable_cache === false) { ob_start(); $this->cached(); $cache = ob_get_clean(); set_transient($this->key, $cache, $this->timeout); } echo $cache; } public function cached() { // Do something... } } class Anno_Featured_Articles extends Anno_Cacheer { public $enable_cache = true; public function cached() { $q = new WP_Query(array( 'meta_query' => array(array( 'key' => '_anno_featured', 'value' => 'on' )), 'post_type' => 'article', 'posts_per_page' => 5 )); if ($q->have_posts()) { ?>