1

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?

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.