Revision: 59823
                            
                                                            
                                    
                                        
Initial Code
                                    
                                    
                                                            
                                    
                                        
Initial URL
                                    
                                    
                                                            
                                    
                                        
Initial Description
                                    
                                    
                                                            
                                    
                                        
Initial Title
                                    
                                    
                                                            
                                    
                                        
Initial Tags
                                    
                                    
                                                            
                                    
                                        
Initial Language
                                    
                                    
                                                    
                        at October 3, 2012 19:56 by Mat_
                            
                            Initial Code
$bandeau_post = get_transient('top1_bandeau_post');
	
if (!is_array($bandeau_post) || count($bandeau_post)==0) {
		
	$args = array(
		'posts_per_page' => 5
		);
	$bandeau_post = array();
	$bandeau_post = query_posts($args);
		
	set_transient('top1_bandeau_post',$bandeau_post,60*60*$timeout);
}
	
foreach($bandeau_post as $post) :
        setup_postdata($post);
// the display code
endforeach;
                                Initial URL
http://www.mp2013.fr
Initial Description
Snippet to show a simple use of the transient API when querying posts.
Initial Title
Query posts and cache the query
Initial Tags
wordpress, query, cache
Initial Language
PHP