Skip Navigation

[Resolved] Toolset relationship filter – only show results that have a relationship

This support ticket is created 2 years, 11 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
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 2 replies, has 2 voices.

Last updated by matthewL-7 2 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#2051487

Hi

I have a toolset relationship filter on my page. I would like to only show options in this filter if they actually have results.

This is different to the existing option in toolset that dynamically shows options in the list if they have results based on other filters etc, I don't wish to do that due to performance reasons and I don't want to use it on other filters.

I would like to just have this filter have a permanent list but only show results that have any posts for the CPT "offer" that this page searches.

I understand this might be a specific use case, if its not possible do you think I could hire a Toolset contractor that would be able to hook into something to achieve this?

Thanks.

#2052199

Hello, there is no public filter or shortcode option available for filtering the options in a front-end post relationship filter like this. I think the most practical solution, if the filter options are "known" and fairly constant over time, is to use custom JavaScript to remove any unwanted options from the filters after the View loads. I think a contractor who understands JavaScript would be able to handle that for you. If the filter options aren't predetermined, or are fairly inconsistent over time, it could be more complicated because you would need to use the PHP post relationship APIs to determine the available options programmatically, then inject JavaScript into the page based on those API results. I think a contractor who understands PHP and JavaScript could accomplish this for you.

#2056677

OK thanks a lot, I will look into this 🙂

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.