Skip Navigation

[Resolved] Displaying related categories for each item

This thread is resolved. Here is a description of the problem and solution.

Problem:

How to show related posts from the same category in a single post.

Solution:

In the single post template, add a view and set it to show the post type.

On the right sidebar under the Query Filter select taxonomies and select the

Set by the page where this View is shown

value.

Relevant Documentation:

https://toolset.com/course-lesson/displaying-related-posts/

This support ticket is created 2 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by davidF-23 2 years, 11 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2309411

Tell us what you are trying to do?

I know this must be a dumb question + I've been starting at the screen too long.

I have:

- a custom post type 'books'
- a hierarchical taxonomy 'genre'
- a flat taxonomy 'book tags'

In my single post template for books, below the individual book I want to display 'related' books by genre.

I'm a bit confused on how to do that. Trying to achieve the same thing like when you have a single wordpress post, and you see related posts at the bottom. Thanks!

#2309629

Christopher Amirian
Supporter

Languages: English (English )

Screen Shot 2022-03-06 at 18.27.43.png

Hi there,

As you want to show related books, it means you want to show many items from the custom post type.

That is why in the section that you want to add the related books, you need to add another View block and select the Books for the content and use the same method you used in the archive page to add the book cover title, ...

In the View block options, under the Content Selection section you will have an option called: Query Filter.

There please select the taxonomy in question. And for the value of the taxonomy select this option:

Set by the page where this View is shown

It means that the taxonomy in question will have the same value that the current page post type has. And that will filter the books to have the same term that the single book item you are in now.

I hope I could give context.

Thanks.

#2310863

That did it, thanks so much!