Created
January 8, 2015 07:47
-
-
Save danpette/28098bd7d55c19fbaaa7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$now = time(); | |
$cache_timer = get_option('frontpage_categories_box_cachetime', $now); | |
if ($cache_timer > $now) { | |
$content = get_option('frontpage_cateogires_box_content'); | |
if (empty($content)) { | |
ob_start(); | |
include 'views/frontpage_categories_box.php'; | |
$content = ob_get_clean(); | |
update_option('frontpage_cateogires_box_content', $content); | |
update_option('frontpage_categories_box_cachetime', (time() + (60 * 60))); | |
} | |
return $content; | |
} | |
else { | |
ob_start(); | |
include 'views/frontpage_categories_box.php'; | |
$content = ob_get_clean(); | |
update_option('frontpage_categories_box_cachetime', (time() + (60 * 60))); | |
update_option('frontpage_cateogires_box_content', $content); | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment