Working Example: User Selected Dropdown to Filter Results
-
I am using this on a site, and thought that it might be helpful to share. The first part creates a drop down and pulls the terms for the dropdown from a taxonomy called property-city (basically a list of cities that are associated with posts). The form action is blank, it refers back to the page it is on that way. So it basically creates the global variable filter=[id]. Only thing I can’t figure out yet is how to have the filter variable that is selected change that particular item to <option [id] selected> when the page reloads…
[pass global=query fields=filter,order_by]
[form action=]
[select name=filter]
[for each=property-city]
<option value=[each id]>
[each]</option>
[/for]
[/select][input type=submit]
[/form][loop type=agent order_by=alpha]
[-if field=cities_serviced compare=”=” value={FILTER}]
[field title]
[/if]
[/loop]
The topic ‘Working Example: User Selected Dropdown to Filter Results’ is closed to new replies.