Skip Navigation

[Resolved] Need to create a custom field that shows links to related posts of the same type

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

Problem: I would like to create a dictionary-style site where each definition is a post in a custom post type. On the single definition page, I would like to show links to related definitions.

Solution: Use a custom taxonomy instead of a custom field. Create a term for each definition. Make sure the slug of the term matches the slug of each definition post.

Think of this taxonomy as "Where I want this Definition to appear as a related Definition". If you want to show Definition B and Definition C as related terms on the Definition A single post page, you must edit Definition B and Definition C. In both of these Definitions, you must select the term that matches Definition A in your custom taxonomy.

The relationships you define in each Definition only work in one direction, so if you want to show Definition A as a related term on the Definition B page, you must edit Definition A and select the term that matches Definition B.

Next, create a View of Definitions. Filter this View by your custom taxonomy, and select the option to supply a taxonomy term by shortcode URL. In this example, the shortcode parameter is wpvdefinitionrelationship. Place this View on your Definition Content Template or Layout. Use the [wpv-post-slug] shortcode to supply the relationship taxonomy term value:

[wpv-view name="related-definitions-view" wpvdefinitionrelationship="[wpv-post-slug]"]

This only works if the Taxonomy Term slug matches the Definition slug, as mentioned earlier.

Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/
https://toolset.com/documentation/user-guides/passing-arguments-to-views/
https://toolset.com/documentation/user-guides/front-page-filters/

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

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 17 replies, has 3 voices.

Last updated by liatG 6 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#742952
Screen Shot 2018-04-26 at 9.45.56 AM.png

Christian,

This is an old topic you helped me with, but I'm not noticing that in the loop output for the "related terms view" There is a space showing up before each comma that separates the related terms (see attached screen shot). I cannot find where this space is coming from. Let me know if I should be setting up a new thread to get your help here.

Thanks again!
Laura

#742977

It's probably in the Loop Output editor of the Related Definitions View. You can try removing the spaces and line breaks between the wpv-item shortcodes, like this:

[wpv-item index=1][wpv-post-link][wpv-item index=other], [wpv-post-link]
#1245415

This helped me too! Thank you.