Wordpress 如何在主页上显示最新的文章(仅一篇)以及全文、评论和所有内容?
在Wordpress上,我如何在主页上显示最新的文章(仅一篇)以及全文、评论和所有内容Wordpress 如何在主页上显示最新的文章(仅一篇)以及全文、评论和所有内容?,wordpress,post,Wordpress,Post,在Wordpress上,我如何在主页上显示最新的文章(仅一篇)以及全文、评论和所有内容 我基本上希望主页是最新的帖子,就像我点击了它并获得了帖子url一样(比如:domain/wordpress/?p=18。从home.php重定向: if (have_posts()): while (have_posts()): the_post(); wp_redirect(get_permalink()); endwhile; endif; 下面是我要做的
我基本上希望主页是最新的帖子,就像我点击了它并获得了帖子url一样(比如:
domain/wordpress/?p=18
。从home.php重定向:
if (have_posts()):
while (have_posts()):
the_post();
wp_redirect(get_permalink());
endwhile;
endif;
下面是我要做的:
- 在WordPress管理面板中的 在侧边栏中,单击“设置” 阅读
- 确保顶部单选按钮位于下方 首页显示(“您最新的 选择“发布”)
- 现在更改下一个框中的数字 至“博客页面最多显示”至1
- 现在,确保“全文” “For each”旁边的单选按钮 文章在一个饲料,显示“被选中
这应该可以,但如果对你不起作用,请告诉我。:) 谢谢大家的回复。我按照你的建议做了李斯特:-) windyjonas,你的回答部分正确。最终成功的秘诀是:
<?php query_posts(); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a>
</h2>
<div class="entry"><?php the_content(); ?></div>
</div>
<?php endwhile; ?>
<?php
global $withcomments; $withcomments = true;
comments_template( '', true );
?>