Apologies in advance - I can't seem to find my way to this answer even though I know it exists. I would like to create a link inside of a view loop that links to the post in the loop but specifies the content template to use.
Specifically, I have a custom post type called "contacts". Normally the default content template for "contacts" would be used to display the post, but if a user clicks on "e-mail this contact" I want it to display the contact using a different content template called "Template for E-Mailing Contacts." This content template contains a form.
Thanks in advance for the help.
- Aaron
Hi Aaron,
Thank you for contacting us and I'd be happy to assist.
You can override the assigned content template, through the ID of the different content template in the URL parameter "content-template-id".
For example, suppose that your post's URL is:
yourwebsite.com/test-post/
To see it with a different content template (whose ID is 1234), the URL would be:
yourwebsite.com/test-post/?content-template-id=1234
In your view's loop, you can generate this link, like this:
<a href="[wpv-post-url]?content-template-id=1234">[wpv-post-title]</a>
Please replace "1234" with the actual ID of the content template "Template for E-Mailing Contacts".
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
My issue is resolved now. Thank you!