您可以将隐藏字段添加到搜索表单中,并基于此添加其他模板:
<form role="search" method="get" id="searchsupport" action="/">
<label class="screen-reader-text" for="s">Search for:</label>
<input type="text" onfocus="if (this.value == \'Search\')
{this.value = \'\';}" onblur="if (this.value == \'\')
{this.value = \'search\';}" id="s" name="s" value="search" class="search-form round">
<input type="hidden" id="searchsubmit">
<!-- this is the magic field --->
<input type="hidden" name="custom_search" value="1">
<input type=\'hidden\' name=\'post_type\' value=\'software, documents\' />
</form>
然后在主题的搜索中。最顶端的php添加:
if (isset($_GET[\'custom_search\']) && $_GET[\'custom_search\'] == 1){
include(\'custom_search.php\'); // change it to whatever template file you would like to use
break;
}