Excluding one category in Wordpress
I just started out using wordpress as a CMS. On the site I have 2 pages I want different posts to show on. So far I understand this small code to post only one particular category one a page (when put infront of the loop:
<?php query_posts('cat=8&showposts=5');?>
But wh开发者_如何学JAVAat do I write when I need to exclude this category on my blog-page?
Just add a minus to it. Example:
query_posts('cat=-3');
You should only include the loop/category you want displayed on each page. Meaning you should have an index page and your secondary page should be a separate file within your template file. Then edit your categories accordingly.
index.php - query_posts('cat=BLOG&showposts=5');
other.php - query_posts('cat=OTHER&showposts=5');
Then create your page within the administration panel accordingly.
精彩评论