Sometimes we need to modify wordpress templates to meet our demands, for example, we need to show latest posts under certain category only, say category id is 11. How to do then? Here is the code I have used for www.xuyi365.org
<?php query_posts('showposts=5&cat=29'); while(have_posts()) : the_post(); ?> <ul> <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li> </ul> <?php endwhile;?>
I have add the above code for www.xuyi365.org right bar, the complete code is:
<aside id="categories-3"><div><h3>Housing News</h3><div></div></div> <?php query_posts('showposts=5&cat=29'); while(have_posts()) : the_post(); ?> <ul> <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li> </ul> <?php endwhile;?> </aside>
The code will show 5 lates posts under category 29.