繁体   English   中英

占位符 web 表单中的 get_search_form(wordpress)

[英]get_search_form(wordpress) in a placeholder web form

我制作了一个占位符 web 表格:

<input type="text" value="Search" onfocus="if (this.value == 'Search') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search';}" >

现在我需要在此添加 Wordpress get_search_form 代码以允许此表单搜索我的网站。 你们能帮我看看如何实施吗?

继承人搜索。php 代码: http://i.stack.imgur.com/NfWi0.png

还有一个名为 searchform.php 的模板文件。 这是一个模板文件,通常包含在许多主题的侧边栏中,并生成搜索框表单。 如果您的主题中没有,您可以轻松地从默认主题中复制它,或者下面的代码

    <form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
    <label for="s" class="assistive-text"><?php _e( 'Search' ); ?></label>
    <input type="text" name="s" id="s" placeholder="<?php esc_attr_e( 'Search' ); ?>" onfocus="if (this.value == 'Search') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search';}" />
    <input type="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search' ); ?>" />
</form>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM