In a website (still in construction) I have one custom Port Type: “Cases”.
I am looking for a way to apply 2 different Content Templates to Case posts.
One is to display all fields on one page.
The other is to display only a few fields in a different lay-out. This page will serve as a kind of “certificate” and will be printable on paper or as pdf.
3 In this thread I found another suggestion: https://toolset.com/forums/topic/link-to-multiple-single-pagecontent-template/,
but the conclusion in the end of the thread said Ok so unfortunately its not possible as the content template need to be assigned in the post edit page so it wouldn't be abe to dynamically render a content template for a post.
Do you thing solution 2 is worth trying?
Would it be possible to generate the page with the “certificate” template by clicking a button on the original single page view?
Below is an impression of how the 2 pages should look.
Single template 1 for Case
Title
Description
Field 1
Field 2
Field 3
…
Field 43
Taxonomy terms
Etc.
…
Button: click here to view (or download) your certificate
Where:
- $id is the post ID and you have to assign the original content template ID instead of 1,2 and 3. You can adjust the code as per your requirement.
I added the [wpv-conditional] shortcode to display the text "Download certificate" in the content template conditionally: if the select field "Download certificate" is checked / has the value of "1". This works.
Now I want the text "Download certificate" to be a button / link to a post or page with the content template for that specific case, showing only a few of the fields and in a different lay-out.
I am using the block editor.
Do I have to create a second content template for the CPT "Cases"?
How do I assign that template to the CPT "Cases" as it seems only possible to assign 1 content template to 1 CPT?
How do I auto-generate the link to the post or page for that specific case?
You should try to create another content template and add your desired fields there as per your requirement and do not assign this content template to any post type.
Then, you should link your content template with content template ID.
for example:
<em><u>hidden link</u></em>
Where:
- 9999 is the content template ID with different layout.
Thank you, Minesh, I got this working.
Just one issue to resolve:
In my original content template I have a map that shows the location of the specific case.
I want this map to display on the certificate template as well. But the marker does not appear there, only an empty map without any marker.
New threads created by Minesh and linked to this one are listed below:
Glad to know that solution I shared help you to resolve your issue.
We entertain only one question per ticket. This will help other users searching on the forum as well as help us to write correct problem resolution summery. I'll split the ticket with your new question and you are welcome to mark this ticket resolved.
Configuring the marker in the map's setting sections in the sidebar:
As this template is not assigned to any post type, I could not configure map's marker setting sections in the sidebar.
I resolved this by temporarily assigning the template for EOW passport Passport to CPT Cases.
Then I was able to adjust the marker settings.
After adjusting the marker settings I reassigned the Template for cases to CPT Cases.
And now the map + marker displays OK.
Case single: hidden link
Case EOW passport single: hidden link