Skip Navigation

[Resolved] Recommendation for associating posts with other custom post types

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

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)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by cantonB 8 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#356180

I'd like a recommendation on how to accomplish something using Types. Here's the scenario:

Imagine that I have a custom post type called "Countries" -- e.g. Finland, UK, etc. These custom posts are used to create overview pages for the countries with all kinds of custom fields (e.g. population, size, etc.)

Now imagine that I am writing a regular blog post (ordinary built-in WP post.) It's a news item and I want to indicate what country or countries the blog post relates to. At the bottom of the post, a reader might see "Related countries: Finland, United Kingdom" -- and by clicking on a related country, should end up on the *custom post page for that country.*

How do you recommend I set this up?

My only idea so far is:

1) Set up custom post type for countries

2) ALSO set up a custom taxonomy called countries

3) When authoring a blog post, I'll use the custom taxonomy to associate the post with countries

4) Find a plugin or write some code that makes it so that when someone tries to visit the archive page for a country custom taxonomy, it instead redirects to the country custom post with the same slug

I wonder if I'm over-complicating things? Is there a better solution?

Thanks for any help.

#356222

Dear canton,

In your case, it is required to setup many-to-many relationships between post type "Countries" and "post".

There are two options you can use within Types plugin:
1) Using WordPress taxonomy
2) Using an intermediary custom type
See our document:
How do I associate one child with several parents of the same type?
https://toolset.com/faq/how-do-i-associate-one-child-with-several-parents-of-the-same-type/

Hope it help

#356306

Thank you. These are both very helpful guides.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.