Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




update_post_thumbnail_cache [ WordPress Function ]

update_post_thumbnail_cache ( $wp_query = null )
Parameters:
  • (object) $wp_query Optional. A WP_Query instance. Defaults to the $wp_query global.
Defined at:



Update cache for thumbnails in the current loop

Source


<?php
function update_post_thumbnail_cache$wp_query null ) {
    if ( ! 
$wp_query )
        
$wp_query $GLOBALS['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 ) ) {
        
_prime_post_caches$thumb_idsfalsetrue );
    }

    
$wp_query->thumbnails_cached true;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics