• Resolved jamiedustuk

    (@jamiedustuk)


    Where do I find the code for the search form? all i see in sidebar.php is get_search_form, i want to add a value to the input box

Viewing 6 replies - 1 through 6 (of 6 total)
  • To display the form you use

    <?php include (TEMPLATEPATH . '/searchform.php'); ?>

    To do that you need to have searchform.php, which should be part of your theme in the same directory and should look something like:

    <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
    	<label class="hidden" for="s"><?php _e('Search this site:'); ?></label>
    	<input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
    	<input type="submit" id="searchsubmit" value="Search" />
    </form>

    By editing that HTML you can add a value. I THINK that the get search form gets the results – maybe?

    Thread Starter jamiedustuk

    (@jamiedustuk)

    im using the default template to display the form it uses <?php get_search_form(); ?> and i dont have a searchform.php in my template folder, so i wondered where it could be?
    thinking about it maybe i could just copy the outputted html and use that instead of the get_search_form ?

    Thread Starter jamiedustuk

    (@jamiedustuk)

    ok i copied the outputted html wich was the same as you showed here and it works fine

    it would still be nice to know where <?php get_search_form(); ?> gets the form from in the default template?

    Seems like it does the same thing. Maybe your searchform.php doesnt exist or is in a weird place

    https://codex.www.ads-software.com/Function_Reference/get_search_form

    I believe, since 2.7, if you have searchform.php in your theme, WordPress will use that. If not, it will generate the HTML from wp-includes/general-template.php

    So if you want to customize your search form and you don’t have searchform.php in your theme, all you need is just create it, paste the code Tom gave above and customize ??

    Yves

    (@worthwhileluxury)

    hi all. I have the search form php in my template. I have also copied the code you refer to above to my template.
    I have deactivated all my feedburner plugins but whenever someone tries to search the blog, the feedburner popup window appears.
    What is it in my searchform.php that makes this happen. I have tried everything.
    Can you help?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Search Form’ is closed to new replies.