After installing from the plugin repository, activate the plugin and head over to Sidebar > Related Posts. From here you can configure Related Posts.
Related posts will start working out of the box but there are some useful options you can set on the admin page.
This is what the options do:
- By default the related posts markup will be applied as a part of the
get_content()output. Unchecking this means it won’t get applied via
get_content(). You’ll need to put
<?php get_related_posts_thumbnails(); ?>somewhere inside the loop.
- Outputs debug as HTML comments. Useful for figuring out what options are enabled, what is the query retrieving, etc.
- Display related posts on single posts only.
- Which post types to show the related posts on. By default, it will only show on the Post post type.
- If unchecked, you can select which categories to enable the related posts for.
- What categories should the display posts show for. Again, if unchecked you can individually select each category.
- Select the date after which the related posts should show.
- Change the related post title.
- The number of related posts to show.
- Default image to show if no featured image is set.
- Thumbnail source. Default is featured posts otherwise you can use a custom field attached to the post.
Luckily you won’t need to set anything as it works perfectly well out of the box.
This is how it looks like when using the default twentyseventeen theme:
It will show everything in a 3 column grid but there are options to change the layout and the styling of the related posts output.
There was another error before this but that was my mistake. Turns out, I forgot to remove the
get_related_posts_thumbnails() method call. Remember to wrap that inside a
function_exists() call next time.
Unfortunately there was another error. After changing the style settings something went wrong with the plugin and it started throwing syntax errors:
Disabling and reactivating the plugin removed the errors. I reckon the errors show up when certain options are selected under a specific condition.
Other than the options provided, you can also style the thumbnails inside the Thumbnail options page. In the admin options page, open the Style options and mess with the options to change the styling. You can also disable the styling provided by selecting the output style to list mode and checking the tick box next to it.
You can also change the relation based on which posts are shown from categories only to:
- Categories and tags
- Tags only
For custom, you can select category, post_tag, or post_format.
It would be awesome if you could filter the relationship via a filter instead of custom relationship settings provided.