Skip Navigation

[Resolved] View only show child custom type

This support ticket is created 4 years 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 4 years ago.

Assisted by: Christian Cox.

Author
Posts
#1860529

Hi!
I have a custom type 'shops' which has a custom type 'promotions' related. I would like that when I click on the 'promotions' button it will direct me to a page with only the promotions of that shops. I've done the promotions view but it shows me all the promotions, not just the ones that are linked to the parent custom type. Could you help me?

#1860827
url-param.png

Hello, when you create a View of the Promotions post type, you can add a Query Filter (https://toolset.com/course-lesson/creating-a-view/#filter-the-list-of-posts) that filters by Post Relationship. You can set up that filter to respond to a URL parameter (see url-param.png). Then in the Shop post template, insert a link to the page containing the View of Promotions and include the current Shop post ID in the link as using the desired URL parameter. You can use this custom HTML as an example for creating such a link with the URL parameter wpv-related-to, as shown in my attachment:

<a href="<em><u>hidden link</u></em> item='$current_page']">Promotions for this Shop</a>

Change the URL to match the URL of the page containing the View of Promotions. When someone clicks the link on the Shop page, they will be redirected to the page containing the Promotions View, with the correct URL parameter and value automatically applied.