[Resolved] Multiple templates (per role) for same custom post type
The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.
I'd like to define multiple templates for the same CPT depending on the custom role: for instance, if you have the custom role A and display the page for a given CPT, you see it with a certain layout, but if you have the custom role B, when you display the same CPT, you see it with a different layout.
The idea is that A users are able to create CPT and edit some informations in them, while B users review the CPTs created by A users and can see/edit different aspects of the same CPT. I'm putting CRED forms in those layouts, and those can be differentiated using Access Control, but content of the layout needs to be different also.
Actually you wouldn't be able to use multiple template for different users however you can use our conditional shortcode to change the display per user.
You can use the shortcode above along with our conditional to evaluate the role of the user and then change how the content is displayed based on the role.
Thanks for the quick reply.
I'm not entirely sure how I'm supposed to use these shortcodes: today I have a single Layout defined for my CPT, its content is defined with the Layouts editor. Are you saying I should add to that template all the elements of the second template I need for the same CPT, and bracket each element with a conditional?
That sounds a bit cumbersome and convoluted.
Did you have any success in implementing the proposed solution of multiple designs within a single template?
Any feedback you could provide would be appreciated.
I am trying to come up with an appropriate solution to the same general problem of displaying a given CPT in a customized way for each of multiple user types/roles.
I have the Groups plugin installed, and it can control content based on group membership/capabilities. The page functional elements must be enclosed within a Groups shortcode in order to control whether they are displayed. However, using the Toolset Layouts plugin, the only Layout element that supports this technique is the Visual Editor because none of the other Layout elements provide the capability to enclose the rendered code within the Groups shortcode. So, I may have to employ the approach described above. My main concern is whether I can get the Toolset conditionals to test for Groups-based user metadata.
John
The forum ‘Types Community Support’ is closed to new topics and replies.