Find out how to view associated posts by class in WordPress


Related posts can be a great way to drive traffic to other posts on your website.

But what if you want to control which category appears in your related posts section?

In this post, we’re going to cover two simple methods you can use to view related posts by category.

Let’s begin:

Method # 1: Use Your Theme

Many themes, especially premium themes, have a built-in function for related posts. Take Hestia, one of the most popular free themes for WordPress, as an example.

The free version has a related post feature built right into the topic so you can see related posts at the bottom of each blog post. The topic’s documentation even references an extension you can install to view related posts by category.

If your theme doesn’t have this functionality built in, check out the documentation as it might have a tutorial on how to implement a related posts section or a suggestion on how to use a third-party solution.

You should also just google your theme name plus “related posts” to see if there are any third-party tutorials on how to implement this feature with your specific theme.

astra-related posts

If not, other solutions are available to you.

Method # 2: Install a Related Posts Plugin

For this method we will use the Yet Another Related Posts plugin. It will automatically show related posts from the same category as the current post.

It’s available in the official plugin repository so you can install and activate it directly from the WordPress administrator.

install yet another plugin for related posts

The settings for this plugin can be found under Settings → YARPP.

Let’s start with “The Pool” first. Posts from all categories and tags are shown by default. This section allows you to hide posts that are assigned to specific categories and tags. If you want to hide categories and tags completely, check these out.

yarpp prohibits categories

You can also find taxonomies for other post types here.

The next setting, Show Password Protected Posts, can be a strategic marketing strategy if you have a content-restricted membership program on your website. By showing these types of posts in your related posts section, you have the ability to drive more traffic to a password-protected page that is advertising your membership program.

A related posts section also gives you the opportunity to drive traffic to older posts. We therefore do not recommend activating the option “Only show posts from the last X months”.

We also recommend checking the “Only show posts older than current post” option because your latest posts will be promoted on your website, social media, and email list.

Finally, be careful with the “Show Results of All Post Types” option as it will display pages, products, testimonials, courses, and any other post types that you use on your website.

Configure display options

Take a look at the “The Algorithm” section. It enables you to teach YARPP’s algorithm how to find posts that relate to the current post.

yarpp algorithm

With these settings, you can have the plugin consider the title and body text of each post before it is displayed as a related post to the current post.

Most importantly, you can request that each related post have at least one category in common with the current post. Tags are taken into account by default.

We recommend that you set categories for other post types to “Don’t take into account”.

Next is the Automatic Display Options section. The settings here control how related posts are displayed on your website.

yarpp automatic display options

First, choose where you want related posts to appear. However, we recommend that you only select posts as pages will likely have a specific call-to-action that you want users to interact with.

Choose how many related posts you want to see and which display option you want to use. The thumbnails option is most effective, especially if you or your graphic designer is working hard to make sure they are appealing.

You can even choose a size for your thumbnails that you want to use, though you will likely have to preview the related posts on your site and play around with the settings until they suit your tastes.

Enter your own text in the Standard display if no results box if you want, although the standard text is descriptive enough. Just be sure to leave the paragraph tags in the latter field.

Finally, choose whether or not to show related posts in RSS feeds. This can prove to be an effective content promotion strategy.

Be sure to save your settings.

Use related posts

Check out the WordPress editor for one of your blog posts. There you will find a metabox for YARPP with a preview of the specific related posts that will be shown for you.

yarpp WordPress editor

If you don’t like these options, click Refresh to force the plugin to find more.

yarpp related posts frontend

YARPP also has a widget that allows you to view related posts in widget areas. These can be displayed in list or thumbnail view. Premium users can set up custom display options.

Yarpp related posts widget

And that’s it – you’re done.

Final thoughts

Whenever possible, you should try to use the related Posts features included in your WordPress theme. This is usually the best option for performance – especially given the fact that you don’t have to install an additional plugin.

However, most WordPress performance issues can be resolved in the front end by using a tool like NitroPack or by upgrading to a better WordPress web host.

Related reading:

How to view related posts by category in WordPress


Don’t miss these tips!

We don’t spam! Read our privacy policy for more info.

Leave A Reply

Your email address will not be published.