Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There may be a way to do this with javascript.</p> <p>Add a hidden textbox with the name "s" and rename the selectboxes.</p> <p>On each select onchange attribute call a javascript that adds the current selectbox's value to the hidden textbox.</p> <p>When the form is submitted the hidden box have the value "dog red" and should be passed as ?s=dog+red</p> <p>I am at work now so dont have time to work out a code sample.</p> <pre><code>&lt;script type="text/javascript" charset="utf-8"&gt; function add_criteria (el) { search = document.getElementById('search_criteria'); search.value = document.getElementById('type').value + " " + document.getElementById('color').value; } &lt;/script&gt; &lt;form role="search" method="get" id="searchform" action="test.html"&gt; &lt;label class="screen-reader-text" for="s"&gt;Search for:&lt;/label&gt; Type &lt;select name='type' id='type' class='postform' onchange="add_criteria(this);"&gt; &lt;option value='' selected='selected'&gt;All&lt;/option&gt; &lt;option class="level-0" value="dog"&gt;Dog&lt;/option&gt; &lt;option class="level-0" value="cat"&gt;Cat&lt;/option&gt; &lt;/select&gt; Color &lt;select name='color' id='color' class='postform' onchange="add_criteria(this);"&gt; &lt;option value='' selected='selected'&gt;All&lt;/option&gt; &lt;option class="level-0" value="red"&gt;red&lt;/option&gt; &lt;option class="level-0" value="white"&gt;white&lt;/option&gt; &lt;option class="level-0" value="green"&gt;green&lt;/option&gt; &lt;/select&gt; &lt;input type="hidden" id="search_criteria" value="" name="s" /&gt; &lt;input type="submit" id="searchsubmit" value="Search" /&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>This may not be crossbrowser compatible (only tested in firefox). And if Wordpress uses jQuery or another javascript library this can be simplified but this is the general idea.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload