Problem: I have a "select" custom field configured on my posts, and a View of these posts filtered by the custom field. The filter does not seem to be working as expected.
Solution: In general you should compare the custom field content instead of display text in your Query Filter. For example, on the trustees page you should test to see if the value is "1", not "trustees".
Pro tip: use a shortcode attribute to define the value you want to test in your Query Filter. Choose "Board is a string equal to a shortcode attribute 'board'". See the attached screenshot for an example. This way, you can place the same View on each page without needing 3 different Views:
Trustees page: [wpv-view name='your-view-slug' board='1'] Planning page: [wpv-view name='your-view-slug' board='2'] Zoning page: [wpv-view name='your-view-slug' board='3']
This is called passing arguments into Views, and it allows you to create dynamic Views that can be reused in different contexts.
Relevant Documentation:
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/
https://toolset.com/documentation/user-guides/passing-arguments-to-views/
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 7 years ago.
Assisted by: Christian Cox.