• Resolved pcr1066

    (@pcr1066)


    Please can anyone explain where the code is for the search form that appears at the top of the sidebar.

    I have tried searching in the default theme and the classic theme, in fact I searched the full WordPress folder but was unable to find any file called “searchform.php”.

    Further, I have spent some considerable time searching the internet for help regarding customising of the search form. Every post I have come across mentions editing the “searchform.php” file.

    Clearly, in WordPress 2.8.4 the file has been removed from the default and classic themes, but where is it?

    The form must be contained within another file somewhere in the WordPress folder.

Viewing 5 replies - 1 through 5 (of 5 total)
  • searchform.php
    comes with the default theme – really

    Thread Starter pcr1066

    (@pcr1066)

    Thank you for the reply Sambol, but no it is not in the default, or classic, themes. So many have siad this but it is simply not true!

    Download the latest copy and do a search, you will not find any file called “searchform.php” with the installation files.

    I had the same type of problem with a module for Drupal (Categories). In the end it turned out that the author had forgotten to add the file. Looks like WordPress may have done the some in their latest release! (Or this was intentional!)

    I have solved this however by downloading another theme. Had todownload a few before I found one that contained the file. I was then able to add this to my own theme and customise (Yes it is spelt c.u.s.t.o.m.i.S.e – Sorry one of my pet hates!) accordingly.

    Finally thanks for your quick reply to my query, and thanks for

    Hey I encountered the same problem.

    I installed WordPress about a week ago, and it’s true. There is definitely no searchform.php file in the default theme.

    The strange part is that there’s virtually nothing written anywhere about why it’s missing or what it contained. I solved the problem pretty much the same way, borrowing the file from someone else’s theme.

    It was included in the source files of this great WordPress themebuilding tutorial:
    webdesignerwall.com/tutorials/building-custom-wordpress-theme

    For anyone else who is in need of it, simply copy the following text into your text editor and save it as searchform.php.

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

    Examples/default-code can be seen on the following Codex page.
    http://codex.ww.wp.xz.cn/Function_Reference/get_search_form

    Strange… I have been working with WP for a while as well… and poof… no searchform.php standard in classic and default… However, it is in the wp-include folder around line 124 inside the general-template.php file…

    Look for

    $form = '<form role="search" method="get" id="searchform" action="' . get_option('home') . '/" >
    	<div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label>
    	<input type="text" value="' . esc_attr(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
    	<input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
    	</div>
    	</form>';

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘searchform.php’ is closed to new replies.