I am trying to: Display conditional search filter
Link to a page where the issue can be seen: versteckter Link
I expected to see: Something like this - versteckter 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
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.
Please disregard this issue for now as we have implemented this differently. Thanks for the prompt response as always.