Skip Navigation

[Resolved] Filter by custom field

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user has a custom field on their taxonomy that will tell if the taxonomy should be displayed on the frontend.

Solution:

The solution was explained in the link below. https://toolset.com/forums/topic/filter-by-custom-field/#post-1196309

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.

This topic contains 2 replies, has 2 voices.

Last updated by thomasS-11 1 year, 6 months ago.

Assigned support staff: Shane.

Author
Posts
#1196146

I created a custom Types checkbox (show on frontpage) on WooCommerce categories.

I cannot set this field as a filter in my Taxonomy View where i list all WooCommerce categories.

I then thought i could just use conditional output to filter it out - but the Types custom checkbox field (show on frontpage) is not listed in the conditional output options.

What am i doing wrong?

#1196309

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Thomas,

Thank you for getting in touch.

From your post I gather that you are displaying a list of Woocommerce product categories using views, however you want to filter that list that is displayed with a query filter.

I recognise that the term custom fields do not show up in the GUI but you can add the information to the conditional manually.

Here is an example that I used that works well.

[wpv-conditional if="('[types termmeta='show-on-front' separator=', '][/types]' eq '1' )" ]
          [wpv-taxonomy-title]
[/wpv-conditional]

All I did was to use the shortcode that I would normally use to display the field's value and then just add it to the conditional. In the conditional you see that i'm checking if the value is equal to 1. This is because on my backend the custom field value is set to 1 but the label is Show on Frontend.

Please let me know if this helps.

Thanks,
Shane

#1197169

That's what i did too after i posted this topic, and it worked for me.

I had bad experience using conditional fields from my previous topic with WooCommerce category images, and i thought that Views didn't support fields not in the GUI.