我正在使用wordpress主题,我想根据类别在不同的页面上显示帖子。如何在wordpress的不同页面上显示不同类别的不同帖子?
例如页面名称是“博客”,帖子类别是postBlog,你能告诉我如何根据类别使用帖子。
感谢
我正在使用wordpress主题,我想根据类别在不同的页面上显示帖子。如何在wordpress的不同页面上显示不同类别的不同帖子?
例如页面名称是“博客”,帖子类别是postBlog,你能告诉我如何根据类别使用帖子。
感谢
你到底做可以WordPress Category Template实现。
从食品:
For instance, when a viewer clicks on a link to one of the Categories on your site, he or she is taken to a page listing the Posts from that particular Category in chronological order, from newest Posts at the top to oldest at the bottom.
您可以创建你的主题文件,名为:category.php
,把loop
它的内部,然后WordPress会自动为你做的。
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
然后用页面填写您的需求。您可以检查文档The Loop
here in this link。
建立在你的主题目录模板category-catname.php
或category-catID.php
。
我觉得人们会感到困惑,试图使用页面时,他们实际上更好使用类别。如果您想让博客文章显示在不同的网址或“网页”上,那么您所要做的就是设置您的类别并将这些类别放入您的菜单中。然后,当您发布时,请确保选择要显示该帖子的类别。你根本不需要使用网页。页面对静态内容更好。
祝你好运,我希望这会有所帮助。
请检查我的答案。 –