I'm trying to add some checkbox options to a sidebar search box, similar to this, where the user has the option to choose whether to search All Words
, Some Word
, or the Entire phrase
.
I did find this after some searching - Wordpress Search Phrases. The 'sentence' option seems to work well, but the others not so good.
The code below is what I'm working on at the moment, but would really appreciate some help to get this working properly. Many thanks in advance, S. (I do not wish to use plugins for this).
<form action="<?php bloginfo('home'); ?>/" method="post">
<div class="search-icon">
<label for="search" accesskey="4" class="hidden">Search the site</label>
<input type="text" name="s" id="search" value="Enter search term" onblur="this.value = this.value || this.defaultValue;" onfocus="this.value = '';" />
<input type="submit" name="submit" value="GO" class="s-btn" />
<p><a href="#" id="search-anchor">Search Options</a></p>
<div class="option-slide">
<input type="radio" name="sentence" value="" checked="checked" /><label>All Words</label><br />
<input type="radio" name="sentence" value="or" /><label>Some Word</label><br />
<input type="radio" name="sentence" value="and" /><label>Entire phrase</label>
</div>
</div></form>
EDIT: The answer below doesn't actually work after all : ( Anybody else have any ideas please?