Hello.
in this post: https://toolset.com/forums/topic/creating-multiple-layouts-to-posts-or-custodia-posts/ Christian Cox states that with toolset, multiple content templates can co-exist for each custom post type.
Reading his response and looking at an actual content template I have a question ...
(see attached screenshot)
in the "Usage" section, in the right hand column of the wordpress block editor, to the right of my custom post type, is a "set conditions" link that pops up the standard Toolset Conditions editor window.
Am I correct in assuming that I can have the system select the content template to use to display a post based on content in an actual post when that post is being added? for example, lets say I have a custom radio button or select field called "Food Type" that has the values "Fruit, Vegetable, Meat, etc..." If the user adds a post called "Hamburger" and indicates that it is a "Meat food type" ... will this cause Toolset to automatically use the Meat Content Template to generate the front-end display of the post as opposed to the Vegetable content template?
Am I correct in this assumption? or am I misunderstanding the usage of that "Set Conditions" popup link
thx!
Gordon
Hi Gordon,
Thank you for contacting us and I'd be happy to assist.
Your understanding is mostly correct and this practical usage example will make it more clear.
1. Suppose, your website has a custom post type "Food Items" and it has a custom taxonomy "Food Types" with terms like "Meat", "Vegetable", "Fruit" etc.
2. First, you'll create a default or a fallback content template "CT for Food Items", that will be assigned to all "Food Items" posts without any set condition.
3. Suppose, your goal is to show posts with "Meat" and "Vegetable" terms to show differently from the rest. So, you'll create two new content templates "CT for Food Items - Meat" and "CT for Food Items - Vegetable".
On the content template edit screens for these new templates, you'll select the "Food Items" post type in "Usage" settings the same way as the first template "CT for Food Items". The only difference would be that this time you'll be adding the condition, to use this template only if "Food Type" taxonomy contains "Meat" ( for template "CT for Food Items - Meat" ) and "Vegetable" ( for template "CT for Food Items - Vegetable" ), respectively.
The end result would be that the system will show the posts with the "Meat" term using the "CT for Food Items - Meat" and posts with the "Vegetable" term using the "CT for Food Items - Vegetable".
And for the "Food Items" posts where any of these conditions are not met, the fallback template "CT for Food Items" will be used.
Note: this content template logic will be managed automatically and you won't have to make any changes for this on the edit screen of the individual "Food Items" posts.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar