Skip Navigation

[Resolved] List posts containing the same term

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

Problem:

I have a CPT called Terms created by the encyclopedia/glossary/wiki plugin by Dennis Hoppe.

I would like to add a view to each of these posts with a list of all the regular posts and pages containing the term in question.

E.g. On the term "apple" I would like to add a list of all pages and posts containing the term "apple".

Solution:

you can try these:

1) Setup many-to-many relationship between post types "Terms" and "regular posts and pages"

One "Terms" post can connect with multiple "regular posts and pages"

One page/post can connect with multiple "Terms" posts

https://toolset.com/course-lesson/how-to-set-up-post-relationships-in-wordpress/

2) And follow our document to display related "regular posts and pages" in single "Terms" post:

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

Relevant Documentation:

This support ticket is created 4 years, 1 month 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 3 voices.

Last updated by hugoC-3 4 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1819489

Tell us what you are trying to do?
I have a CPT called Terms created by the encyclopedia/glossary/wiki plugin by Dennis Hoppe.
I would like to add a view to each of these posts with a list of all the regular posts and pages containing the term in question.
E.g. On the term "apple" I would like to add a list of all pages and posts containing the term "apple".

Is there any documentation that you are following?
https://toolset.com/lesson-placement/lesson-placements-1729031-1730449/

What is the link to your site?
Local install

#1821087

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

How does the plugin work?

If the apple "term" is not actually a term (a taxonomy term) and is in fact a custom post, how are normal posts and pages "assigned" the apple "term" connected to it?

Presumably you can visit the apple "term" on the front-end as a post at a URL like site.com/term/apple/.

#1821491

The "term" indeed is not a taxonomy term but a custom post. You can visit the post at an URL like site.com/term/apple/ as you said.
The plugin creates tooltips in each post or page where the term occurs and an alphabetical archive (glossary).

So if a post contains the word "apple", when you hover on it you get a tooltip with the explanation of the term.

What I would like to do: when you visit the custom post "apple" you get a list of all posts and pages where the term "apple" occurs. I imagine this can be done with a content template for the cpt "term" containing a view that is filtered by "all articles where the word "apple" (= the title of the custom post) is found".

I am just not sure how to do that: how to create a query that fonds all posts and pages with the term "apple" in the content.

#1821923

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

How to set up the filter is the key part, and without knowing how the plugin connects its "term" posts to the posts the "term" is assigned to it's impossible to give you any direction on how to do that.

Does the plugin document how this works?

#1821957

Hello,

I assume you are going to setup post type relationship between post types "Terms" and "regular posts and pages", you can try these:
1) Setup many-to-many relationship between post types "Terms" and "regular posts and pages"
One "Terms" post can connect with multiple "regular posts and pages"
One page/post can connect with multiple "Terms" posts
https://toolset.com/course-lesson/how-to-set-up-post-relationships-in-wordpress/

2) And follow our document to display related "regular posts and pages" in single "Terms" post:
https://toolset.com/course-lesson/displaying-related-posts/#displaying-many-related-items

#1824473

My issue is resolved now. Thank you!

#1842293

I managed to set up a post relationship between a cpt "Term" and "regular posts and pages".
I created a content template for "Term" post type with a view containing related posts (posts that have been connected to the "Term" post.
However I still have one question: is there a way to connect posts and pages automatically to each "Term" cpt instead of having to connect each post/page manually?

The scenario: if a post or page contains a certain term it is automatically added to the related posts section of the cpt 'Term" in question.
E.g. If a post contains the word "banana" it is automatically added to the related posts view in the cpt "Banana".
Is that possible?