1
我做了以下在我的主页上显示一个帖子:如何让wordpress仅在评论和评论表单的首页显示一篇文章?
home.php:
<?php
get_header();
query_posts('posts_per_page=1'); //returns only the front page
?>
<div id="content">
<?php
/* Run the loop to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-index.php and that will be used instead.
*/
get_template_part('loop', 'index');
?>
</div>
<div id="sidebar">
<?php get_sidebar(); ?>
</div>
<div id="footer">
<?php get_footer(); ?>
但我还是ahave点击Comments
才能看到的评论和形式发表评论。我如何自动显示?
对不起,我将该代码放在#content div之前,什么都没发生! – alexchenco 2010-07-07 09:55:56
如果要在加载循环之前显示注释,请调用'the_post()',加载注释,然后使用'rewind_posts()'重置循环。 – TheDeadMedic 2010-07-07 11:03:03