首页 > CMS教程 > WordPress    日期:2018-10-04 / 来自互联网 / 浏览

WordPress模板标签the_search_query用于输出搜索关键词,通常用在搜索表单和搜索结果页中。

the_search_query()

该函数没有任何参数,直接调用即可。

the_search_query()函数使用示例

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

扩展阅读

the_search_query()函数位于:wp-includes/general-template.php

相关函数:

get_search_query()

觉得上面的内容有用吗?快来点个赞吧!

点赞() 我要打赏

温馨提示 : 本站内容来自会员投稿以及互联网,所有源码及教程均为作者总结编辑,请大家在使用过程中提前做好备份,以免发生无法预知的错误,源码类教程请勿直接用于生产环境!

 可能感兴趣的文章