是的,很有可能,您只需创建自己的搜索表单和处理函数表单:
<form name="tag-search" method="POST" action="">
<input type="text" vlaue="" name="tag-q" id="tag-q">
<input type="submit" name="tag-submit" id="tag-submit" value="Search Tags">
</form>
正在处理:
<?php
if (isset($_POST[\'tag-submit\']) && $_POST[\'tag-submit\'] == "Search Tags" && isset($_POST[\'tag-q\']) && $_POST[\'tag-q\'] != ""){
// @todo Sanity check and cleanup $_POST[\'tag-q\'] here.
$args = array(\'name__like\' => $_POST[\'tag-q\']);
$tags = get_tags($args);
$html = \'<div class="post_tags_search_r">\';
foreach ($tags as $tag){
$tag_link = get_tag_link($tag->term_id);
$html .= "<a href=\'{$tag_link}\' title=\'{$tag->name} Tag\' class=\'{$tag->slug}\'>";
$html .= "{$tag->name}</a>";
}
$html .= \'</div>\';
echo $html;
}
?>
不,这是我过去用过的东西,唯一的缺点是
name__like
不区分大小写,因此您可能需要添加
strtolower 将版本改为\\uu like名称。