Divi: the easiest WordPress theme to use
Are you looking for the best WordPress themes and plugins?
Download the best plugins and WordPress themes on Envato and easily create your website. Already more than 49.720.000 downloads. [EXCLUSIVE]
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.
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.
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.
Easily create your website with Elementor
Elementor allows you to easily create any website design with a professional look. Stop paying expensive for what you can do yourself. [Free]
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.
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.
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 WordPress theme files. 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 WordPress theme files where you want to display recent posts of a specific category.
have_posts ()): $ catquery-> the_post (); ?>
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:
have_posts ()): $ catquery-> the_post (); ?>
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 look and optimize the grip of your blog or website.
Divi: The best WordPress theme of all time!
With over 701.000 downloads, Divi is the most popular WordPress theme in the world. It is complete, easy to use and comes with more than 62 free templates. [Recommended]
We offer you here some premium WordPress plugins that will help you do that.
1. WooCommerce Page Builder
WooCommerce Page Builder is a very popular premium WordPress plugin which offers a fairly consistent number of shortcodes and which allows you to create several types of personalized pages (product, cart, checkout, "my Account") on your WooCommerce website.
It is a premium extension of the Visual Composer plugin that you must install beforehand. 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.
2. Testimonial Showcase
Testimonial Showcase is a premium WordPress plugin that allows you to display testimonials, reviews, or other quotes in multiple ways.
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.
The most downloaded slider on CodeCanyon, Royal Slider comes loaded with irresistible features. Used by companies as diverse as Coca-Cola, Ralph Lauren, and Land Rover, this premium WordPress plugin does just about everything you might expect from a slider.
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.
Discover our 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.
Easily create your Online Store
Download free WooCommerce, the best e-commerce plugins to sell your physical and digital products on WordPress. [Recommended]
Find out about other recommended resources to help you build and manage your website.
- How to make an external link with the title of a WordPress article
- How to create beautiful transitions of pages on WordPress
- How to insert a table on WordPress with the TablePress plugin
- How to fix the "missing temporary folder" error on WordPress
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.
If you have suggestions or remarks, leave them in our section Comments.