WordPress 高级搜索设计 : WordPress 按分类搜索

编辑: 日期:2010-07-11 分类:Wordpress教程 留言:23条留言 3人推荐推荐一下
简介: WordPress 高级搜索设计 : WordPress 按分类搜索 Wordpress 按分类搜索目前很少人在用,99%的wordpress都是用普通的搜索方式,代码如下: <form action="<?php bloginfo('url'); ?>" method="get" id="search"> <input name="s" type="...
WordPress 高级搜索设计 : WordPress 按分类搜索

WordPress 高级搜索设计 : WordPress 按分类搜索

Wordpress 按分类搜索目前很少人在用,99%的wordpress都是用普通的搜索方式,代码如下:

<form action="<?php bloginfo('url'); ?>" method="get" id="search">
<input name="s" type="text" />
<input type="submit" value="" />
</form>

个人还是比较喜欢高级的搜索方法,按分类进行搜索,代码如下:

<form id="searchform" name="searchform" method="get" action="<?php bloginfo('home'); ?>/" >
<ul>
<li><p><?php $select = wp_dropdown_categories('class=search_select&show_option_all=全站搜索&orderby=name&hierarchical=0&selected=-1&depth=1');?></p></li>
<li><input type="text" name="s" id="s" maxlength="34" value=""/></li>
<li><input type="image" value="" src="<?php bloginfo('template_url'); ?>/img/search.gif"/></li>
</ul>
</form>

 

wordpress还有另外一种方法实现高级搜索,选项框选择的高级搜索,这个需要wordpress设计者手动填写分类的ID,这种搜索的源代码如下:

<div>
<form id="index_search" name="index_search" method="get" action="<?php bloginfo('home'); ?>/">
<p><input type="text" name="s" id="s" value=""/> <input type="submit" value=" 搜 索 " /></p>
<p>
<label for="s_type5" style="width:50px"><input type="radio" name="cat" id="cat" value="all" checked>全站</label>
<label for="s_type1" style="width:50px"><input type="radio" name="cat" id="cat" value="4" checked>主题</label>
<label for="s_type2" style="width:50px"><input type="radio" name="cat" id="cat" value="6">插件</label>
<label for="s_type3" style="width:50px"><input type="radio" name="cat" id="cat" value="3">主机</label>
<label for="s_type4" style="width:50px"><input type="radio" name="cat" id="cat" value="10">经验</label>
</p>
</form>
</div>

本文链接:WordPress 高级搜索设计 : WordPress 按分类搜索

版权所有:维普设计 - 转载请注明出处

客户留言 设置头像 23条
4645

1 2  共 23 条评论
 
主题定制 在线客服