Show category posts on a page
by pixelithe on Juni 25, 2009
Sometimes I want to list posts from a certain category on a page. Makes sense especially when I use WordPress as a CMS on commercial sites. Until today I have used redirection plugins for that purpose (e.g. page links to plugin). One of the big problems with this method is that the wordpress conditional highlighting in the Menu doesn’t work anymore (because you have left the page and have been redirected to a category).
Luckily I have stumbled upon a piece of code that is as easy as logical and makes me want to bang my head against the wall asking myself why I didn’t have this idea…
<?php if (is_page('93'))
{
query_posts('cat=4')
} ?>
Works fine and solves the Problem.
Leave your comment