最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to make a search form?

programmeradmin2浏览0评论

I'm taking my first steps in wordpress, pretty newbie. and I find that I want to make a search form with its own styles and a little javascript to redimension. So I do not know how I should proceed in several ways.

  • Is it better to use the get_search_form () method, inspect and change their styles? like for example the search-field class or for html5 searchform?
    OR
    Is it better to make my own form from scratch if it is going to have (many) changes?

  • In the case that it is better to use get_search_form (), I inspect and change the styles directly? or do I support html5 and change the styles of these? Or is there a way to embed additional classes to the said form?

  • in the case that it is better to make my own form as I do so that wordpress detects it as a search form? or that failing to do the search?

I'm taking my first steps in wordpress, pretty newbie. and I find that I want to make a search form with its own styles and a little javascript to redimension. So I do not know how I should proceed in several ways.

  • Is it better to use the get_search_form () method, inspect and change their styles? like for example the search-field class or for html5 searchform?
    OR
    Is it better to make my own form from scratch if it is going to have (many) changes?

  • In the case that it is better to use get_search_form (), I inspect and change the styles directly? or do I support html5 and change the styles of these? Or is there a way to embed additional classes to the said form?

  • in the case that it is better to make my own form as I do so that wordpress detects it as a search form? or that failing to do the search?

Share Improve this question edited May 31, 2019 at 18:02 fuxia 107k39 gold badges255 silver badges459 bronze badges asked May 31, 2019 at 17:59 user70587user70587 131 silver badge3 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

When you code get_search_form() WP search searchform.php in your theme root and print all inside that file. And you can create searchform.php inside your theme root and insert this:

    <form role="search" method="get" action="<?php echo home_url('/'); ?>">
        <fieldset>
            <input type="text" name="s" value="<?php the_search_query(); ?>">
            <button></button>
        </fieldset>
    </form>

That basic search form. Then code <?php get_search_form() ?> where you want this form in your theme. You can add your own class or ID inside that form and change what you want. Also I put link for couple notes about search_form

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论