Skip Navigation

[Resolved] Possible to have multiple content templates?

This support ticket is created 5 years 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 4 years, 12 months ago.

Assisted by: Christian Cox.

Author
Posts
#1223447

Is it possible to have more than one content template for a single post?

I have a content template for my post type that displays Fields A, B, C and D.

I would like to have a second content template that displays Fields A, B, E and F.

Ideally, there would be a clickable link from the first content template to the second.

#1223541

Hi, I can help you apply different Content Templates to posts programmatically, but I'm not quite sure I understand how the links would work. Where is the link shown? Let's say your post URL is https://yoursite.com/book/oliver-twist and this is where content template 1 displays. What exactly happens when someone clicks the link? Is the User directed to a different URL?

#1223655

Hi Christian

To be honest I'm pretty relaxed about how we would get to the content as I have two different audiences. The post type is a school bus route like this: hidden link

The first audience is general. The content template would have the following fields:
Title > Post body > Bus route description > Bus route map > School bus ID number
This content is available on an 'open' website.

The second audience needs to log in to view some of the content. That content template would have the following fields:
Title > Bus route description > Bus route map > School bus ID number > Bus driver name > Bus driver phone number
Some of that content cannot be shown on an open website.

A third potential use of this data would be:
Title > Bus route map
This content is available on an 'open' website but I want to 'strip back' as much content as possible to make the map working better on a small device.

I'm starting to feel like the best way to achieve this would be to use conditional tags, but I'm looking forward to seeing what you have to say.

#1223987

Yes, I agree conditional HTML would probably be best here. The overall design will remain consistent across open and logged-in sites, but some data within that design will be shown or hidden based on login status. You can use a conditional to verify the current User's ID. If it's 1 or greater, then you know the User is logged in. If not, you know the User is logged out.

For the third potential use of the data, it depends on where you want to display this stripped down map. If you use a different page on the site to display this information, a separate Content Template specific to that page might be a good idea. Another option is to use a CSS-based approach that shows and hides content based on screen resolution: https://www.w3schools.com/css/css_rwd_mediaqueries.asp
That might be over-complicating things, though, if a separate Page is okay.

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