Skip Navigation

[Resuelto] How to filter by the custom fields selected on a page

This support ticket is created hace 8 años, 6 meses. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

Etiquetado: 

This topic contains 4 respuestas, has 2 mensajes.

Last updated by Daniella hace 8 años, 6 meses.

Assisted by: Luo Yang.

Autor
Mensajes
#340948
Screen Shot 2015-10-19 at 3.36.37 PM.png

I am trying to: I have ACF installed with "Product Facets". I added those custom fields to a Page. Based on the selection of those fields (see screenshot), I would like to have the Page output the results. So if Bracelets and Amber are selected, the page outputs the products that match.
Thanks.

I visited this URL:

I expected to see:

Instead, I got:

#341010

Dear Daniella,

I suggest you setup a view to filter with shortcode attribute,
when you put the view into content, set the attribute value maually, for example:

[wpv-view name="houses" bracelets ='[wpv-post-field name="bracelets "]']

See our document:
Controlling the filter with shortcode attributes
https://toolset.com/documentation/user-guides/passing-arguments-to-views/

#341092

Yes, I understand the shortcodes, but is there a way to avoid adding the shortcodes and just have the page display what checkboxes are selected?

#341295

Since you are requesting filter the view by custom fields value of current page, Views needs to know what value it is, so you will need pass the custom fields value to Views. according to our document:
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/
section "Source for compare value"

The easiest way without PHP code is using "Shortcode attribute": The value for the filter comes from an attribute in the View shortcode

Also you can specific the values by Views filter hook "wpv_filter_query" to apply such a filter:
https://toolset.com/documentation/user-guides/views-filters/wpv_filter_query/
wpv_filter_query
When displaying a View listing posts, this filter is applied to the arguments being generated by the View settings before they are passed to the WP_Query class.

Hope it help

#341499

Great, thanks!

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