作者:mb97ujp | 来源:互联网 | 2023-07-25 08:51
篇首语:本文由编程笔记#小编为大家整理,主要介绍了Wordpress根据页面分类显示文章。相关的知识,希望对你有一定的参考价值。Hadmanypeopleask
篇首语:本文由编程笔记#小编为大家整理,主要介绍了Wordpress根据页面分类显示文章。相关的知识,希望对你有一定的参考价值。
Had many people ask me how I display all posts in a category when they click on the category link in the header @
http://www.vagrantradio.com.
There's a lot more involved, but here's the quick and dirty;
//if is articles page, get posts from this category id and show 9 of them.
php
if (is_page('7') ) {//articles
query_posts('cat=4&showposts=9');
} elseif ( is_page('9') ) {//freebies
query_posts('cat=5&showposts=9');
} elseif ( is_page('356') ) {//inspiration
query_posts('cat=30&showposts=9');
} elseif ( is_page('949') ) {//tutorials
query_posts('cat=6&showposts=9');
} else {
$cat = '';
}
?>