Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_search_form

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 3 times in this file.

Line Code
143  * There is also an action that is called whenever the function is run called,
144  * 'get_search_form'. This can be useful for outputting JavaScript that the
145  * search relies on or various formatting that applies to the beginning of the
146  * search. To give a few examples of what it can be used for.
147  *
148  * @since 2.7.0
149  * @param boolean $echo Default to echo and not return the form.
150  */
151 function get_search_form($echo = true) {
152      do_action( 'get_search_form' );
153
154      $search_form_template = locate_template('searchform.php');
155      if ( '' != $search_form_template ) {
156           require($search_form_template);
157           return;
158      }
159
160      $form = '<form role="search" method="get" id="searchform" action="' . esc_url( home_url( '/' ) ) . '" >
161      <div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label>
162      <input type="text" value="' . get_search_query() . '" name="s" id="s" />
163      <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
164      </div>
165      </form>';
166
167      if ( $echo )
168           echo apply_filters('get_search_form', $form);
169      else
170           return apply_filters('get_search_form', $form);
171 }
172
173 /**
174  * Display the Log In/Out link.
175  *
176  * Displays a link, which allows users to navigate to the Log In page to log in
177  * or log out depending on whether they are currently logged in.
178  *
179  * @since 1.5.0