Skip Navigation

[Resolved] Display conditional search filter is not working

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 justinB-3 2 years ago.

Author
Posts
#2538531

I am trying to: Display conditional search filter

Link to a page where the issue can be seen: hidden link

I expected to see: Something like this - hidden link
Although the post types and custom fields were done with Toolset the page isn't build with View
Here's the code I currently have for the search & pagination section:
[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-group">
<label for="wpv-wpcf-territory">[wpml-string context="wpv-views"]Territory[/wpml-string]</label>
[wpv-control-postmeta field="wpcf-territory" url_param="wpv-wpcf-territory"]
</div>
[wpv-conditional if="( $(wpcf-territory) eq '1' )"]
<div class="form-group">
<label for="wpv-wpcf-southeast-states">[wpml-string context="wpv-views"]Southeast States[/wpml-string]</label>
[wpv-control-postmeta type="select" field="wpcf-southeast-states" url_param="wpv-wpcf-southeast-states"]
</div>
[/wpv-conditional]

[wpv-conditional if="( $(wpcf-territory) eq '2' )"]
<div class="form-group">
<label for="wpv-wpcf-northeast-states">[wpml-string context="wpv-views"]Northeast States[/wpml-string]</label>
[wpv-control-postmeta type="select" field="wpcf-northeast-states" url_param="wpv-wpcf-northeast-states"]
</div>[/wpv-conditional]
[wpv-filter-submit output="bootstrap" class="btn-secondary"][/wpv-filter-controls]

[wpv-filter-end]

Instead, I got: Conditional display doesn't work in the search and pagination section but it worked when I tested it inside the loop

#2538627

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

I'm not sure exactly what you are trying to achieve (or what you mean when you say "the page isn't build with View", although it very much looks like a View that you are sharing.

In any case, where you placed those conditional shortcodes to check the field "territory" (which has a post meta key of wpcf-territory), in that context they would be checking the values of that field in the page where you inserted the View, at the time the page is rendered.

Is that what you intend?

I suspect not, if you tested them in the loop section and they worked, as then the context would be the current post of the loop that would be expected to have values for this field.

#2538733

Please disregard this issue for now as we have implemented this differently. Thanks for the prompt response as always.