WP: display posts from specific categories
With one simple code, wordpress can display posts from specific categories. WordPress can be modified to actually behave like a very expensive tool and application. Many peoples that use wordpress and actually write daily news and articles in blogs are so called “plugins fans”. Yes plugins are quite interesting and helpful but in many times, installing more plugins can make the blog to load and behave very slow.
The idea of this post is that I can give you an example to use an simple code, instead of an fancy plugin that will cause to load the page very slow, it can be modified very easy using stylesheet.
<?php $recent = new WP_Query("cat=1&showposts=3");
while($recent->have_posts()) : $recent->the_post();?>
<li>
<a href="<?php the_permalink() ?>" rel="bookmark"
title="<?php the_title(); ?>">
<?php the_title(); ?>
</a>
</li>
<?php endwhile; ?>
</ul>
Explications:
In the code you will find WP_Query:
cat= is for number of the category;
showposts= number of the post that will be displayed from this category.
