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.
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
Thank you. These are both very helpful guides.