Slide 37
Slide 37 text
Transient Caching
'featured',
'posts_per_page' => 5
)
);
// Put the results in a transient. Expire after 12
hours.
set_transient( 'foo_featured_posts', $featured, 12
* HOUR_IN_SECONDS );
}
?>
// Run the loop as normal
have_posts() ) : ?>
have_posts() ) : $featured->the_post(); ?>
// featured posts found, do stuff
// no featured posts found
Using Trasients with WP_Query to retrieve featured posts