Return to Snippet

Revision: 24005
at February 18, 2010 10:28 by vagrantradio


Initial Code
//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 = '';
}
?>

Initial URL


Initial Description
Had many people ask me how I display all posts in a category when they click on the category link in the header @<a href="http://www.vagrantradio.com">http://www.vagrantradio.com</a>. 

There's a lot more involved, but here's the quick and dirty;

Initial Title
Wordpress display posts in category based on page.

Initial Tags
wordpress

Initial Language
PHP