Would you like to view recent posts from a specific category on WordPress?

The default Recent Posts widget displays posts from all categories and there is no option to filter them by category.

In this article, we'll show you how to easily view recent posts from a specific category in WordPress.

But before, if you have never installed WordPress discover How to Install a WordPress Blog in 7 Steps et How to search, install and activate a WordPress theme on your blog 

Then back to why we are here.

view recent posts from a specific category on WordPress

Filtering articles by category on WordPress

If you just want to create a page to display recent posts for a particular category, your WordPress website already has separate pages for each category.

Discover by the way How to allow users to filter articles and pages

You can add links to all pages in your category by visiting the page " Appearance> Widgets And adding the Categories widget to your sidebar. You can also add categories to your navigation menus. 

Check out this article to give style to your navigation menus

On the other hand, if you want to display recent posts from a specific category on your sidebar, there is no default widget for that. The default Recent Posts widget does not allow you to filter posts by category or tag.

Fortunately, there is another way. Let's look at how to easily display recent posts in a specific category on WordPress.

Method 1. Display recent articles of a category using a plugin

This method is easier, and is recommended for most users.

The first thing you need to do is to install and activate the plugin Extended Widget Posts Widget. For more details, check out our step by step guide on how to install a WordPress plugin.

After activating the plugin, you must visit the page " Appearance> Widgets »And add the widget« Recent Posts Extended To your sidebar.

Add a recent posts extended widget on wordpress

The widget menu will expand to show settings. You must select the category or categories that you want to display under the option "Limit to Category».

Try our 5 premium WordPress plugins to optimize your categories

The widget has a lot of options that you can customize. You can view the post thumbnail, date, relative date, summary or snippets, and more.

Do not forget to click on the button « Save To save the settings of your widget.

You can now visit your website to see recent articles posted by category.

How to display recent articles by category using a Shortcode

The widget Extended Posts Extended »Also allows you to use a shortcode to display recent posts on your website, including other pages.

Discover How to add categories to the menu of your WordPress blog

You will need to change the post or page for which you want to view recent posts in a specific category. In the post editor, you need to add the following shortcode:

[Rpwe limit = "5" excerpt = "true" cat = "72"]

This shortcode displays 5 recent articles of a specific category with the post snippet. You must replace the value of the parameter " cat With the ID of the category you want to display.

Consult our tutorial on how to find the category id in WordPress.

After adding the shortcode, you can save your publication or page to validate your changes.

2 method. View recent articles in a category using a code

This method requires you to add code to your files. WordPress theme. If you haven't already, check out our guide on how to copy and paste code in WordPress.

You need to add the following code in your files WordPress theme where you want to display recent posts from a specific category.

<?php $catquery = new WP_Query( 'cat=72&posts_per_page=5' ); ?>
<ul>

<?php while($catquery->have_posts()) : $catquery->the_post(); ?>

<li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
<?php endwhile;
wp_reset_postdata();
?>

The first line of this code creates a new WordPress query with a specific category ID. You must replace it with your category ID. It will only display the title of the publication in a list.

You can change it to display the full content by adding the following code:

<?php $catquery = new WP_Query( 'cat=72&posts_per_page=5' ); ?>
<ul>
<?php while($catquery->have_posts()) : $catquery->the_post(); ?>
<li><h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<ul><li><?php the_content(); ?></li>
</ul>
</li>
<?php endwhile; ?> 
</ul>
<?php wp_reset_postdata(); ?>

You can also replace the " the_content With " the_excerpt To display excerpts from the article instead of the full article.

Discover also some premium WordPress plugins  

You can use other WordPress plugins to give a modern appearance and to optimize the handling of your blog or website.

We offer you here some premium WordPress plugins that will help you do that.

1. WooCommerce Page Builder

WooCommerce Page Builder is a WordPress Plugin very popular premium which offers a fairly consistent number of shortcodes and which allows you to create several types of personalized pages (product, basket, checkout, "my Account") on your WooCommerce website.

WooCommerce-page-builder

It is a premium Visual Composer plugin extension that you need to install first. Thanks to this plugin, you will have the possibility to create unique e-Commerce websites using any WordPress theme, and save you a lot of money.

Download | Demo | Web hosting

2. Testimonial Showcase

Testimonial Showcase is a WordPress Plugin premium which allows to display testimonials, reviews or other quotes in several ways. 

Testimonials showcase for visual composer plugin

It is fully compatible with the latest version of WordPress and Visual Composer. It comes with 5 templates for integrated layouts, perfect for displaying your testimonials.

Read also our article on 5 WordPress plugins to create subscription forms

You will be able to display your testimonials in the form of grid or slider. It is fully customizable and supports the star rating system. You will also be able to allow your users to submit their testimonials on the frontend of your website.

Download | Demo | Web hosting

3. RoyalSlider

The most downloaded slider on CodeCanyon, Royal Slider is packed with irresistible features. Used by companies as diverse as Coca-Cola, Ralph Lauren and Land Rover, this WordPress Plugin premium does pretty much everything you could want from a slider. 

Royalslider touch content slider for wordpress

The most attractive feature is the native full screen support and its layout perfect for displaying high resolution photographs. This plugin will definitely impress your visitors with its professional features.

So much to see... 5 WordPress plugins to add geolocation to a Blog

As features we will have among others: the ability to create several sliders with different styles per page, support for tactile navigation, responsive design, vertical or horizontal thumbnails, bullets or tabs for navigation, and more.

Download | Demo | Web hosting

Recommended Resources

Find out about other recommended resources to help you build and manage your website.

Conclusion

Here! That's all. We hope that it will allow you to easily display recent articles in a category on WordPress. Feel free to share this tutorial with your friends on your favorite social networks

However, you will also be able to consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on the WordPress blog creation.

If you have suggestions or remarks, leave them in our section Comments.

...