An easy WordPress plugin to list category posts
Struggling with how to list category posts on your WordPress site?
Sometimes you need a list of posts in one specific category. And while you can always just link to a category’s archive page, that’s not a workable solution if:
- You’re looking to list category posts inside another piece of content (like a post or page)
- You prefer a simple list or table view to the full category archive layout in your theme
- You want pinpoint control over the exact information that displays for each post in your list
Instead, you might be looking for something like this:
Or perhaps a simple list of product names, like this:
You can find some plugins that give you a shortcode to list category posts. However, these plugins can often fall short when it comes to filtering which posts to display, choosing what content to display in the list (beyond a post’s title), and allowing your visitors to interact with your list of posts.
Posts Table Pro, on the other hand, lets you list WordPress posts from a specific category (or categories) and:
- Filter the list to only include or exclude specific posts from the category. You can even filter by custom fields or taxonomies for pinpoint control of what shows up.
- Add additional columns to display extra information like a post’s author, publish date, or even custom fields and taxonomies.
- Optionally, give your visitors controls to filter, sort, or search your list of posts. AJAX search even allows visitors to view search results without a page reload.
Beyond that, Posts Table Pro can also help you list custom post types from a specific category or custom taxonomy.
In this article, you’ll learn how to list category posts like the example above using Posts Table Pro.
For the tutorial, I’m going to create a list of posts that pulls from the Reviews category on my demo site and includes the review author, the publish date, and the post’s featured image.
How to list category posts with the Posts Table Pro WordPress plugin
Posts Table Pro is a base shortcode that you can customize with a variety of shortcode parameters to control what content to display and how to display it.
The base shortcode looks like this:
In this post, I’m going to focus on the shortcode parameters that apply specifically to this use case (listing a specific category of WordPress posts). But if you want to view a full list of Post Table Pro’s options, you can always check out the documentation:
Tip: This help article has a full list of Posts Table Pro shortcode options.
Step 1: Filter by category
To get started, you need to use the category parameter to specify which category of posts to include in your list.
You need to insert either the slug or the ID for your category. In the example below, I’ve added the slug for my category:
You can find the slug for your category by going to Posts → Categories and looking at the Slug column.
After completing this section, the list looks like this:
Step 2: Choose what information to display in your list
Next, you can set the specific columns to display in your list using the columns parameter.
Posts Table Pro lets you display columns for:
- Post ID
- Any custom field
- Any custom taxonomy
To display multiple columns, you just separate each item with a comma.
For this example, I’ll display the image, title, author, and date like this:
[posts_table columns="image,title,author,date" category="reviews"]
Here’s what this shortcode looks like when rendered on the frontend of my test site:
Step 3: Choose how to order your list
Next, you can choose how to order your list using the sort_by and sort_order parameters.
You can sort by:
- Post ID
- Menu order
- Publish date
- Last modified date
- Comment count
- Post type
For example, here’s how to sort by date, with the oldest posts at the top:
[posts_table columns="image,title,author,date" category="reviews" sort_by="date" sort_order="asc"]
Here’s what this shortcode looks like (notice that the order has changed since the last example):
Step 4: (Optional) Configure which filters to give users access to
Posts Table Pro gives you the option to:
- Add a drop-down filter for specific data. For example, if you display tags you could let visitors choose specific tags from a drop-down to further refine your list of category posts. To control this, you use the filters parameter.
- Hide the search box. By default, Posts Table Pro displays a search box. To move or disable the search box, you use the search_box parameter.
- Hide the pagination options. By default, Posts Table Pro displays a drop-down that lets visitors choose how many posts to list. To move or disable the drop-down, you use the page_length parameter.
Step 5: (Optional) Exclude individual posts from your list
If you want to exclude specific posts in the selected category from the list, the exclude parameter lets you remove individual posts by their post ID.
To find a post’s ID, look at the URL when you’re editing a post:
Step 6: Insert your shortcode where you want your list to display
Now that you’ve built your shortcode, all you need to do is add it to the place where you want your list of category posts to display. Enjoy!
Taking your list of posts even further
Depending on your needs, you can get more creative with the list category posts WordPress plugin. Some helpful advanced tips you can implement are:
- Use custom fields to display a Buy Now button in your list (helpful for listing review posts or categories of products).
- Display custom post types to create a category list of events, audio files, podcast episodes, documents, staff members, and more.
- Add lazy loading for long lists.
- Add a fallback message for when there aren’t any posts to display.
And that’s all you need to list category posts in WordPress. Any other questions? Leave a comment and we’ll try to help out!