简体   繁体   English

wordpress帖子按类别名称循环

[英]wordpress posts loop by category name

I am kinda unlucky to find a proper solution in order to display posts by their category. 我很不幸找不到合适的解决方案,以便按帖子类别显示帖子。 I made a page template that should be supposted to be used in order to display posts by category. 我制作了一个页面模板,该模板应该被禁止使用,以便按类别显示帖子。

Lets say there is a page "Cats" and page "Dogs" and the same named categories for posts are created and assigned depending on either it is cats or dogs. 可以说有一个页面“ Cats”和“ Dogs”,并根据猫或狗来创建和分配相同名称的帖子类别。

How to loop through that? 如何循环通过?

It should follow dynamics to loop posts of category that is named the same as page title(all those pages using same page template). 它应该遵循动态来循环命名与页面标题相同的类别的帖子(所有那些页面都使用相同的页面模板)。 This should solve the case when you need new page for new category and you don't want to dig into the code and so on. 当您需要新页面用于新类别并且您不想深入研究代码等时,这应该可以解决这种情况。

I would really appreciate the help. 我非常感谢您的帮助。 Thanks in forward! 谢谢前进!

If you follow the WordPress template hierarchy , you simply need to name a template file with the category name. 如果遵循WordPress模板层次结构 ,则只需要使用类别名称来命名模板文件。

http://codex.wordpress.org/Category_Templates http://codex.wordpress.org/Category_Templates

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM