WordPress的显示帖子的代码没有显示
问题描述:
我使用此代码显示5个员额的任何职位(任何职务的会做)WordPress的显示帖子的代码没有显示
<div id="featured-post-section">
<div id="post-list">1
<?php query_posts('posts_per_page=5'); ?>2
正如你可以看到,我添加了一个1个2号。 ...之前和之后...我只得到1 2 ...根本没有帖子显示。
我在做什么错?
答
该函数仅告诉Wordpress输出多少帖子。您仍然必须使用WP循环才能实际使用perform the output。
<?php
// The Query
query_posts('posts_per_page=5');
// The Loop
while (have_posts()) : the_post();
echo '<li>';
the_title();
echo '</li>';
endwhile;
// Reset Query
wp_reset_query();