How to make a search form?

I'm taking my first steps in wordpress, pretty newbie. and I find that I want to make a search form with its own st

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745440334a4627801.html

相关推荐

  • How to make a search form?

    I'm taking my first steps in wordpress, pretty newbie. and I find that I want to make a search form with its own st

    2小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信