Take a look at this page.
hidden link
This is the Content Template for a post type Client.
There is a View embedded into the Template which pulls out data of the Vehicle post type via post-relationships.
You can see the link "Details" for each.
Currently this link goes to the Content Template for the post type Vehicle.
But in reality, I want to show different data about each vehicle (i.e. data that is not necessarily included in the Vehicle Post Type Content Template).
How can I do that?
A View with uses some kind of URL parameter in the link?
Hi,
Thank you for contacting us and I'd be happy to assist.
It is possible to override the assigned single post content template using the URL parameter "content-template-id".
For example, suppose you have assigned a content template "CT for Vehicles" to all "Vehicles" single post pages.
Example:
{yourwebsite.com}/testdir/v7/auction-vehicle/502/
To show the same post, with a different content template "Different CT for Vehicles Details", you can pass this new content template's ID in the single post page's URL like this:
Example:
{yourwebsite.com}/testdir/v7/auction-vehicle/502/?content-template-id=123
To generate the link with this URL parameter in your view, you can use:
<a target="_blank" href="[wpv-post-url]?content-template-id=72" rel="noopener">Details</a>
Please replace 123 with your actual content template's ID.
regards,
Waqar
Ah. Excellent.
So can I just go to the "Content Templates" tab, duplicate the Vehicle Content Template and edit as required?
It won't interfere with the "default" vehicle content template?
Thanks for writing back and your understanding is correct.
The "default" vehicle content template won't be affected and it will stay assigned to the single vehicle pages. This assigned template will continue to be used when these single vehicle pages will be visited directly (i.e. without any "content-template-id" URL parameter).
OK. That's terrific!
One question though, after I duplicated the default Content Template for Vehicles it now shows "No Post types/Taxonomies assigned".
hidden link
However, the default template still continues to work, so I am wondering if it is just a UI bug and whether (as a matter of best practice) I should check the box for "Vehicles" post types on the Content Template for Vehicles.
That's terrific. Works great.
Just one question, after duplicating the default Content Template for Vehicles it now shows "No Post types/Taxonomies assigned"
hidden link
Should I manually reassign the Content Template for Vehicles to the Vehicles post type?
Works. Thank you.
However after duplicating the default Content Template it now says "No Post types/Taxonomies assigned".
Should I ignore this OR should I manually reassign the default to Vehicles post type?
Thanks for the update and glad that it works.
It is expected that the duplicated content template says "No Post types/Taxonomies assigned" as we don't want to use this content template automatically.
We only want to use it when it is specifically called through the URL parameter "content-template-id".