Skip Navigation

[Resolved] Specify Content Template in Post URL

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.

This topic contains 2 replies, has 2 voices.

Last updated by aaronM-9 8 months, 4 weeks ago.

Assigned support staff: Waqar.

Author
Posts
#1886227

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

#1886479

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

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

#1888157

My issue is resolved now. Thank you!