1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <?php $loop = get_transient( 'loop' ); if ( false === $loop ) { // Show the last 100 tweets from the custom post type tweets. $query = array('post_per_page' => 100, 'post_type' => 'tweets', 'post_status' => 'publish' ) ; $loop = new WP_Query($query); // transient set to last for 1 hour set_transient('loop', $loop, 60*60); } // do normal loop stuff if ($loop->have_posts()) : while ($loop->have_posts()) : $loop->the_post(); // show content or whatever you like the_content(); endwhile;endif; ?> |
原文链接:https://xiaohost.com/3642.html,转载请注明出处。
评论0