Hi, I am using Toolset to generate my custom post types and custom taxonomies.
Right now, I'll create 4 Custom Post Type for a news website.
I want to create a CPT named "Video Games" to generate a complete detailled sheet of a game.
When I write a post or a news (two different post type), I want to link them to a specific Video Game.
Is there a way to do this so I can create a real link between them?
Hi, it depends on what you mean by "link". If you are referring to adding an HTML hyperlink to one post from another post, then this can be accomplished using the "link" button above any standard text editor area in WordPress post editors or Content Template editors, etc. See the link.png image.
If you mean you want to associate these posts with each other in the back-end of the site and use these relationships to sort and filter Views, then there are multiple ways to do this. You can:
1. Apply the same taxonomy term or terms to all related posts. Filter posts based on that taxonomy term.
2. Create parent / child relationships between related posts. This works best for one-to-many relationships.
3. Create many-to-many relationships between related posts.
4. Use a custom field to apply the same value to related posts in the backend, then filter posts based on that custom field value.
More information about true post relationships here:
https://toolset.com/documentation/user-guides/creating-post-type-relationships/
Let me know if you have additional questions about these approaches and I'll be glad to help.
Thank you for your answer.
I looked at your answer, and I think the common taxonomy will be the best thing.
I'll generate a nice template for the taxonomy, as detailled as a custom post and it should be good!
It's me again.
I tried to work with my idea and your answer but finally it is not what I need.
What I need is to put a field, a select would be the best, to link a specific post to another.
I think it's the "Many-to-many" relationship I need to follow but I want to be sure with my situation :
I have News, Posts and Files (not sure if it's the good english name, it's a subjet made of multiple posts).
The files must be linked by a "previous" and "next" fields so I can create and generate my templates correctly.
They CAN be related to 0 to N companies.
I want to create a sheet about the games and they can be related to 2 companies : one as the editor, one as the developer.
And last thing, I want to make a list of upcoming/regular events and they can be related to 0 to N Games and/or 0 to N companies.
Do you have a solution with the Toolset pack?
What I need is to put a field, a select would be the best, to link a specific post to another.
A many-to-many post relationship provides this type of relationship control in wp-admin between posts in different post types. It's not currently designed to support many-to-many relationships between posts of the same type. So you can't relate File A to File B this way, you would have to come up with a different method to handle this. One option is a repeating number field on the post type, where you can input the ID of any post you want to relate to the current post. This is a manual process and you won't have an easy way to select posts directly in the post editor. You'll have to manually find the post ID and copy + paste it into the field, and you'll have to add it in all the posts.
The files must be linked by a "previous" and "next" fields so I can create and generate my templates correctly.
Since these are posts of the same post type, a many-to-many relationship will not be possible as I mentioned above. If you need to assign next and previous posts, you can create next and previous fields, and copy + paste the correct post IDs in each post. As you can imagine, this becomes difficult to manage. Another option is to use a custom field to specify a numeric order, which you can use in a View to determine the next or previous post in sequence. Again, this will require manual maintenance in each post in wp-admin.
They CAN be related to 0 to N companies.
No problem, this is currently supported by many to many relationships.
I want to create a sheet about the games and they can be related to 2 companies : one as the editor, one as the developer.
This can be accomplished in a many-to-many relationship by adding a custom field to the intermediary post type, where you select the role to apply to a related company for each game. Then you can use that custom field as a filter for any View, or you can access the value of the field with a Types shortcode.
And last thing, I want to make a list of upcoming/regular events and they can be related to 0 to N Games and/or 0 to N companies.
A list showing upcoming events and their related games and/or companies is possible using Views, Views shortcodes, and a date range filter. A list of events related to a specific combination of games and/or companies can be a challenge because of the complex filter involved and many-to-many relationships. I recommend trying this out on a small scale to see exactly what is possible here if a complex filter is required. Feel free to open a separate ticket to discuss the details.