Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: search_form_format

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

Line Code
154  *  If set to 'html5', it changes to search input type and adds placeholder text.
155  *
156  * @param boolean $echo Default to echo and not return the form.
157  * @return string|null String when retrieving, null when displaying or if searchform.php exists.
158  */
159 function get_search_form( $echo = true ) {
160      do_action( 'pre_get_search_form' );
161
162      $format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml';
163      $format = apply_filters( 'search_form_format', $format );
164
165      $search_form_template = locate_template( 'searchform.php' );
166      if ( '' != $search_form_template ) {
167           ob_start();
168           require( $search_form_template );
169           $form = ob_get_clean();
170      } else {
171           if ( 'html5' == $format ) {
172                $form = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '">