While developing of WordPress websites for clients or companies, sometimes we need to get the recent 10 or 5 posts from a specific category. One of my blog reader has asked this question by using my request tutorial form from FreeWebMentor.com.
Today, I am creating an article to help him as well other WordPress enthusiasts. This tutorial will help you lot, so keep your close attention in this tutorial as I am going to share how to display the recent posts from a specific category in WordPress.
Use the below simple code in your theme’s template file OR custom template file where you want to display the recent posts from a specific category. Change the category id from which category you want to display the posts. In below code
WP_Query( 'cat=3&posts_per_page=10' ), I have used
cat=3. 3 is my category id.
$catquery = new WP_Query( 'cat=3&posts_per_page=10' );
while($catquery->have_posts()) : $catquery->the_post();
<h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<li><?php the_content(); ?></li>
<?php endwhile; ?>
I hope this tutorial helped you to fix to upload large image files in WordPress. If you still need any help, feel free to add your comments in below comment section. I will be happy to help.
Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool WordPress tutorials and also don’t forget to subscribe my blog to get all future tutorials directly in your mail box.
Article Tags: list category, list category posts, wordpress category list, wordpress category list plugin, wordpress list of posts, wordpress post category, wordpress post category page, wordpress post category template