Skip to content

Commit

Permalink
more semantics and set specific cache key
Browse files Browse the repository at this point in the history
for splash query in collections component
  • Loading branch information
Bearded Avenger committed Sep 13, 2014
1 parent 3877cc7 commit c2ee4dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions public/includes/components/component-character.php
Expand Up @@ -51,19 +51,19 @@ function aesop_character_shortcode($atts, $content = null) {

<?php do_action('aesop_character_inner_inside_top'); //action ?>

<?php if ($atts['name']) {?>
<?php if ( $atts['name'] ) {?>
<span class="aesop-character-title"><?php echo $atts['name'];?></span>
<?php } ?>

<?php if ($atts['img']) {?>
<?php if ( $atts['img'] ) {?>
<img class="aesop-character-avatar" src="<?php echo $atts['img'];?>" alt="<?php echo $alt;?>">
<?php } ?>

<?php if ($content) {?>
<?php if ( $content ) {?>
<div class="aesop-character-text"><?php echo do_shortcode($content);?></div>
<?php } ?>

<?php if ($atts['caption']) { ?>
<?php if ( $atts['caption'] ) { ?>
<p class="aesop-character-cap"><?php echo $atts['caption'];?></p>
<?php } ?>

Expand Down
10 changes: 5 additions & 5 deletions public/includes/components/component-collections.php
Expand Up @@ -49,10 +49,10 @@ function aesop_collection_shortcode($atts, $content = null) {
<?php

// if collection ID is set
if ($atts['collection']):
if ( $atts['collection'] ):

// if splash mode is set
if ('on' == $atts['splash']) {
if ( 'on' == $atts['splash'] ) {

// cat query args
$cat_args = array(
Expand All @@ -61,12 +61,12 @@ function aesop_collection_shortcode($atts, $content = null) {
);

// get cached query
$cats = wp_cache_get('aesop_splash_query');
$cats = wp_cache_get('aesop_splash_query_'.$atts['collection']);

// if no cached query then cache the query
if (false == $cats ) {
$cats = get_categories(apply_filters('aesop_splash_query',$cat_args));
wp_cache_set('aesop_splash_query', $cats);
$cats = get_categories( apply_filters('aesop_splash_query',$cat_args) );
wp_cache_set('aesop_splash_query_'.$atts['collection'], $cats);
}

if ($cats):
Expand Down

0 comments on commit c2ee4dc

Please sign in to comment.