Skip to content

Instantly share code, notes, and snippets.

@DrewAPicture
Created January 2, 2013 05:53
Show Gist options
  • Save DrewAPicture/4432542 to your computer and use it in GitHub Desktop.
Save DrewAPicture/4432542 to your computer and use it in GitHub Desktop.
Video query transient. The HOUR_IN_SECONDS constant is available in 3.5+, otherwise you can just use something like 60*60
<?php
$query = get_transient( 'video_query' );
if ( false == $query ) {
$query = new WP_Query( $args );
set_transient( 'video_query', $query, HOUR_IN_SECONDS );
}
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();
...
endwhile; endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment