Skip Navigation

[Resolved] filter by multiple numbers

This support ticket is created 3 years, 9 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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 3 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#1708269

This is a theoretical site... but i want to ask if it's possible first

I have a CPT named pipes. Some pipes have multiple diameters, so I use a repeating field group to list them for each pipe. (for example one particular pipe has these diameters: 5, 7, and 9)

on each singular content template for pipes, I want to display a view of all the clamps that will fit the pipe. (in this example i want to display all clamps that are of diameter 5, 7, or 9)

is this possible? if it is not possible without code, is it possible using https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts to find the diameters of the repeating field group, and then use that information to filter the toolset view such that it will display the correct clamps?

#1708481

Hello,

I think it is possible without custom codes.

For example, you can try these:
1) In post type "clamps", setup a custom field "clamps-diameters"
2) Edit each "clamps" post, setup value in field "clamps-diameters"
3) In single "pipe" post, display nested view:
Parent post view,
- query related pipe repeating field group posts
https://toolset.com/course-lesson/creating-and-displaying-repeatable-field-groups/
- In view's loop, you can get each item's "diameters" field value, pass this value as below child post view shortcode attribute

4) Child post view
- Query "clamps" posts
- Filter by field "clamps-diameters" equal to view shortcode attribute value, see our document:
https://toolset.com/documentation/user-guides/views/passing-arguments-to-views/#controlling-the-filter-with-shortcode-attributes
https://toolset.com/documentation/user-guides/views/filtering-views-by-custom-fields/

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