How to create a permalink to display a particular category page

余生颓废 提交于 2020-01-07 02:37:08

问题


In my sidebar I have two categories: 'Product' and 'News'. So I have created two category files category-product.php and category-news.php to display them in a different way.

My question is: how can I create permalinks to display these separate category pages? The default permalink always displays the category.php file. Can anybody please provide some ideas? I'm very new to WordPress.


回答1:


WordPress selects template based on request parse results, not only on permalink structure. When it determines that you request category page then it tries to find category-$slug.php file in theme folder. If this file is not found it tries to find category-$id.php and if it also absent, WP uses category.php.

So double check that product and news are categories slugs (not titles). And try to use debug-bar plugin (http://wordpress.org/extend/plugins/debug-bar/). It can show request parameters.



来源:https://stackoverflow.com/questions/13660584/how-to-create-a-permalink-to-display-a-particular-category-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!