我使用的是以下代码:
<?php
query_posts( 'posts_per_page=5' );
while ( have_posts() ) : the_post();
echo '<li>';
the_title();
echo '</li>';
endwhile;
wp_reset_query();
?>
代码有效,但有2个帖子,并且只返回最新的一个。
我需要它向他们展示。
有人能帮忙吗?
感谢
试试这个:
$query = new WP_Query('posts_per_page=5');
while( $query ->have_posts() ) : $query ->the_post();
echo '<li>';
the_title();
echo '</li>';
endwhile;
wp_reset_postdata();