Skip Navigation

[Resolved] Display different content templates

This support ticket is created 3 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
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by Jamal 3 years ago.

Assisted by: Jamal.

Author
Posts
#2008527

I have a Content Template showing my cpt.
I would like to insert (still within this model) a link to another content model of the same cpt.
In practice I would like to give the browser the possibility to switch between 2 viewing modes of the same post.
Can you give me some suggestions?

#2008551

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello and thank you for contacting the Toolset support.

You have disconnected from the chat before reading my reply. Yes, it is possible to display a post with different content templates, however, this will depend on how do you choose the content template. Can you explain more?
- Would you allow the user to choose what content template to use?
- Would you choose the content template based on a custom field or some logic?

A custom post type cannot be assigned to more than one content template, so I'll suggest the following:
- Create content template A for the first design.
- Create content template B for the second design.
- Create a content template and assign it to the custom post. Inside of it, use conditional shortcodes or blocks to display either content template A or content template B.
Does it make sense?

You can also programmatically choose what template to choose using the wpv_filter_force_template
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_force_template

I hope this helps. Let me know if you have any questions.

#2008567

I probably misplaced the problem.
At this link you see a cpt in a content template
hidden link

(It is a form relating to a training course)
I need to be able to provide the navigator with the possibility of printing this sheet in pdf.

As it is very difficult to adapt the print via plugins or @media print commands
(I can't remove the side buttons and other disturbing elements) I had thought of creating a second display mode with a cleaner and more synthetic structure. The idea was to put a "print version" link inside the form (stamp attached) that would lead to the second mode.

I guess my idea is conceptually wrong.

#2008569

stamp

#2008661

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

I am pretty sure you can remove the button or other elements from the print version using CSS. For example, you can remove elements using the following CSS:

@media print
{    
    .no-print, .no-print *
    {
        display: none !important;
    }
}

Then, add the "no-print" class to those elements or their parent elements.

You can also display a post using a different content template using the "content-template-id" URL parameter. For example, you can display the same post with a different content template with the following URL hidden link
Where 1234 is the ID of that content template.

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