How to Display Posts by Category on a WordPress Page

WordPress automatically displays the latest posts in a reverse chronological order on the home page. But things get a little bit tricky when it comes to sorting them based on different criteria. What if you want to display posts from your desired categories on the home page or any other pages?

Don’t worry, we have got your back. In this blog post, we will guide you through:

  • Method 1: Display WordPress Posts by Assigning Them to Categories (Best Practice)
  • Method 2: Display WordPress Posts by Category Using Query Loop Block
  • Method 3: Display WordPress Posts by Category on a Page Using a Plugin
  • Which Method Should You Choose?

Why Display WordPress Posts by Category on a Specific Page?

Before going into the process of displaying posts, we would like to discuss the reasons behind sorting posts by categories. 

Multiple Categories on One Page: As you want to sort posts based on categories, chances are you want to display posts from multiple categories on a single page.

Better Control and Styling: As category archive pages don’t offer many customization options, you might want to create a custom page, style it as per your requirements, and display posts.

Enhanced User Experience: Some websites or blogs also display posts from all categories on a single page. It ensures better navigation on the website and improves user experience.

Homepage or Landing Page Display: You may not be satisfied with the default category page and want to display posts from specific categories on the home page of your WordPress website. 

Method 1: Display WordPress Posts by Assigning Them to Categories (Best Practice)

If you are just getting started with WordPress, you might not know much about the WordPress category system. I also faced a similar kind of experience back in 2016 when I thought displaying posts from a specific category should be placed on a page. So we are assuming you may also be in a similar situation. To display posts based on categories, we need to follow the steps below:

Step 1: Create Categories

First, we need to go to the Posts >> Categories section from our WordPress categories section and start creating a new category. From this section, we have to add a name to the category and click on the “Add Category” button. 

creating a new category

We can also add a slug and description to the category. If we keep the slug field empty, it will be the same as the category name. Moreover, we can select a parent category if we want to make a child category. Similarly, we can create as many categories as we need.

Step 2: Assign Post to Categories

After creating the categories, we need to go to a post or create a new one. Here you can see that the categories are available on the right side. We just need to click on the checkbox to assign the post to our categories. 

Assigning post to categories

Similarly, we can assign other posts to the categories as well. Moreover, we can also create new categories from this while we are in the post edit mode.

Now, if we go to the category page, we will see that the assigned posts are being displayed. And, we can add to the categories on the menu to let the visitors find them effortlessly.

Method 2: Display WordPress Posts by Category Using Query Loop Block

Now, if you want to display posts by category on a page instead of the category page, you can follow the steps below.

Step 1: Create a New Page

At first, go to the page where you want to display the posts or create a new one. For now, let’s create a new page and add a name to it.

creating a new page

Step 2: Add Query Loop Block

adding query loop block

Thankfully, Gutenberg has its own block to display posts, which is the Query Loop block. So we need to click on the plus icon and add the block to the page. Once we add the block, we can either start from scratch or choose a premade pattern (design). For now, let’s choose a suitable pattern.

Step 3: Sort Posts By Categories

selecting pattern

Now we want to sort the posts of the query loop as we want to display them by categories. For that, we need to go to its settings section, click on the “Filter” option, and select taxonomies. So we can sort the posts by our desired categories or tags. For now, let’s add a category to display posts based on that category.

sorting posts

Method 3: Display WordPress Posts by Category on a Page Using a Plugin

If you want more customization options and better layouts to display posts, you should go for a plugin. You may already know that PostX is one of the best plugins to display posts. It comes with numerous blocks for displaying posts in a post grid, post list, and slider layouts. And most importantly, it gives full customization freedom. So, before starting to follow the steps below, make sure that the PostX plugin is installed on your website. 

Step 1: Add a Posts Block

adding a post block

PostX has multiple variations of Post Grid, Post List, and Post Slider blocks. We need to choose one and drop it on the page. Here you can see that the latest posts on our website are now being displayed. We can further customize the layout by using its settings section. However, we can also explore the layout variations or import a premade pattern.

Step 2: Sort Posts By Categories

Now we can sort the posts by categories using the advanced query builder of PostX. Not only categories, but PostX has all the post sorting options we can think of. Now you can see that the posts from our selected categories are displaying on the post blocks.

sorting posts by category

Which Method Should You Choose?

Probably, you are confused about choosing between the above-mentioned methods. Let us help you make the best decision. 

Method 1: If you just want to display the posts of your website on their category pages, then this method will be the best choice.

Method 2: But if you really want to display posts from categories on a custom page, then you can consider this method. However, make sure the layout of the query loop is also suitable for you.

Method 3: This method is highly recommended for you if you need a vast customization option and want to give your site a modern and professional look.

CriteriaMethod 1: Assign Categories (Best Practice)Method 2: Query Loop BlockMethod 3: Plugin (PostX)
Ease of UseBeginner-friendly, requires minimal effortIntermediate, requires knowledge of Gutenberg blocksEasy, requires installing and configuring a plugin
Customization OptionsLimited, follows default category page layoutModerate, can customize block layout to some extentExtensive, offers multiple layouts and customization
Design FlexibilityLow, mostly text-basedMedium, can choose from some pre-made patternsHigh, numerous block variations and styling options
Display on Specific PageNo, only on category pagesYes, allows custom pagesYes, allows custom pages
Display Multiple Categories on One PageNo, requires separate category pagesYes, using multiple blocksYes, using advanced query builder
Excluding Specific PostsNot supportedLimited, may require custom query modificationYes, through advanced settings
Suitable ForBasic use, category-specific listingBasic custom pages with some layout flexibilityAdvanced use, professional designs, and enhanced functionality

You may also like to read:

Conclusion 

That’s all from this blog post. We hope that now you can use a suitable method and display posts best on your desired categories. Please let us know if you face any difficulties or have any confusion. You can also share your feedback regarding this article by commenting on the section below. 

Can I exclude specific posts from displaying on a page?

Yes, you can exclude specific posts from displaying on a page by using the query builder of PostX.

Can I display posts by multiple categories on a WordPress page?

Yes, display posts by multiple categories on a WordPress page. For that, you can use the Gutenberg Query Loop block or the PostX plugin.

Is it possible to display posts from categories on the homepage?

Yes, you can display posts from categories on the home page. For that, you need to create a custom page with your desired posts and set it as the home page of your website.

Like this article? Spread the word
Omith Hasan

Written byOmith Hasan

I started my WordPress Journey back in 2016 when I discovered how easy it was to create a blog using WordPress. So, I learned WordPress, Content Writing, and Search Engine Optimization to start my blogging Journey. Then, I learned about WooCommerce and also started writing about it. I love to write problem-solving-related content to help and educate WordPress and WooCommerce users.

Leave a Reply

Your email address will not be published. Required fields are marked *