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 2 times in this file.

Line Code
107  *
108  * There is also an action that is called whenever the function is run called,
109  * 'get_search_form'. This can be useful for outputting JavaScript that the
110  * search relies on or various formatting that applies to the beginning of the
111  * search. To give a few examples of what it can be used for.
112  *
113  * @since 2.7.0
114  */
115 function get_search_form() {
116      do_action( 'get_search_form' );
117
118      $search_form_template = locate_template(array('searchform.php'));
119      if ( '' != $search_form_template ) {
120           require($search_form_template);
121           return;
122      }
123
124      $form = '<form role="search" method="get" id="searchform" action="' . get_option('home') . '/" >
125      <div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label>
126      <input type="text" value="' . esc_attr(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
127      <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
128      </div>
129      </form>';
130
131      echo apply_filters('get_search_form', $form);
132 }
133
134 /**
135  * Display the Log In/Out link.
136  *
137  * Displays a link, which allows the user to navigate to the Log In page to log in
138  * or log out depending on whether or not they are currently logged in.
139  *
140  * @since 1.5.0