Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Reply To: [Waiting for user confirmation] Parametric search: how to use HTML optgroup option value as url_param="City"

$
0
0

Hi Luo,

It's a way to indent list items in a HTML select element (http://www.w3schools.com/tags/tag_optgroup.asp). The optgroup label isn't selectable and styled differently than the following list items, similar to a heading or title (how exactly depends on the browser) – the code basically looks like this:

<select>
  <optgroup label="Swedish Cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
  </optgroup>
  <optgroup label="German Cars">
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
  </optgroup>
</select>

I tried your code snippet and it seems to correctly add the url_param to the query slug. The search however isn't working a s it should, here's what I did so far and what's happening:

1) fresh WP install
2) installation of the real estate demo content
3) Now when I search for something that's 100% not in the content (e.g. "Volvo") the search result page displays all posts. I compared the search query (http://mywebsite.com/211-2/?city=volvo&state=&sqfeetmin=&sqfeetmax=&pricemin=&pricemax=&wpv_filter_submit=Search) to the query on a demo site I created on discover-wp.com and it's exactly the same (http://tl-3035-re-2.discover-wp.com/211-2/?city=volvo&state=&sqfeetmin=&sqfeetmax=&pricemin=&pricemax=&wpv_filter_submit=Search).

The problem is that while the demo site on discover-wp.com correctly displays "No posts found" my site just displays all posts without applying the search query. I didn't add the aforementioned dropdown by HTML code but used the default HTML your real estate installer created for me. Any idea what's happening here?

Cheers,
Thomas


Viewing all articles
Browse latest Browse all 20145

Trending Articles