Struggling with how to list category posts on your WordPress site?
Sometimes you need a list of posts in one specific category - you might want to
- Showcase a particular author's work
- Display posts based around a key topic for your users
- Ensure greater visibility for the full range of content on your site (as opposed to just recent posts), boosting your content's rankings and therefore your whole site's SEO.
You could always just link to a category’s archive page, but that’s often 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 includes far more in-depth functionality:
- 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 for wordpress.org sites 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
- Thumbnail Image
- 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 5: (Optional) Configure which filters to give users access to
Posts Table Pro comes with some built-in styling and is designed to look good with most themes. Where possible, it takes styles from your theme such as the fonts.
If you want to style the table further, such as adding alternating background colors to the table rows, changing the color of the sort arrows, and more, you can add custom CSS to your theme or child theme. Our documentation contains a full list of CSS selectors that you can use to help list category posts in style.
Step 5: (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 6: (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 7: (Optional) Choose the number of posts to display
You can choose how many items are listed on each page of the table, as well as the total number of posts in the table. The rows_per_page option controls how many rows display on each page of results in the table, and the post_limit option controls the maximum number of posts displayed in your table.
Final Step: 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. You could put it on an entirely new page to ensure maximum visibility, or embed it on your home page.
You can also display the list of posts in a widget - this is as simple as adding the shortcode to any text widget, including those on your home page.
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 particular categories of products).
- Display custom post types to create a category list of events, audio files, podcast episodes, documents, staff members, and more.
- Upgrade the default WordPress Posts Archive sidebar widget to show posts in the tabular archive layout by adding the Posts Table Pro shortcode directly to a custom 'archive.php' template.
- Add lazy loading for long lists.
- Add a fallback message for when there aren't any posts to display for a given category name.
And that’s all you need to get started with the best list category posts plugin for WordPress. Any other questions? Leave a comment and we’ll try to help out! We're always happy to get Posts Table Pro running on your site.