Skip to content

Instantly share code, notes, and snippets.

@micahwave
Created August 2, 2012 19:53
Show Gist options
  • Save micahwave/3240092 to your computer and use it in GitHub Desktop.
Save micahwave/3240092 to your computer and use it in GitHub Desktop.
tax query
$latest_galleries = wp_cache_get( 'latest_galleries', 'time_gallery_cache' );
if( !$latest_galleries ) {
$latest_galleries = get_posts( array(
'posts_per_page' => 6,
'post_status' => 'publish',
'tax_query' => array( array(
'taxonomy' => 'time_post_format',
'field' => 'slug',
'terms' => 'time-post-format-gallery'
))
));
if( $latest_galleries ) {
wp_cache_set( 'latest_galleries', $latest_galleries, 'time_gallery_cache', 7200 ); // every 2 hrs
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment