Definition:
function update_post_thumbnail_cache() {}
Update cache for thumbnails in the current loop
Source code
function update_post_thumbnail_cache() {
global $wp_query;
if ( $wp_query->thumbnails_cached )
return;
$thumb_ids = array();
foreach ( $wp_query->posts as $post ) {
if ( $id = get_post_thumbnail_id( $post->ID ) )
$thumb_ids[] = $id;
}
if ( ! empty ( $thumb_ids ) ) {
get_posts( array(
'update_post_term_cache' => false,
'include' => $thumb_ids,
'post_type' => 'attachment',
'post_status' => 'inherit',
'nopaging' => true
) );
}
$wp_query->thumbnails_cached = true;
}
14820

July 5, 2011 


No comments yet... Be the first to leave a reply!