Skip Navigation

[Resolved] How to create a view which is dependent on a link from another view

This support ticket is created 3 years, 8 months 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: Asia/Karachi (GMT+05:00)

This topic contains 7 replies, has 2 voices.

Last updated by Waqar 3 years, 8 months ago.

Assisted by: Waqar.

Author
Posts
#1977919

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?

#1978065

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

#1978089

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?

#1978125

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).

#1979229

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.

#1979233

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?

#1979237

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?

#1979319

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".