[wp-trac] [WordPress Trac] #14851: Add ¨searchform-{name}.php¨ support

WordPress Trac wp-trac at lists.automattic.com
Tue Sep 14 23:35:40 UTC 2010


#14851: Add ¨searchform-{name}.php¨ support
-------------------------+--------------------------------------------------
 Reporter:  ramiy        |       Owner:                 
     Type:  enhancement  |      Status:  new            
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Template     |     Version:  3.1            
 Severity:  normal       |    Keywords:  need-patch     
-------------------------+--------------------------------------------------

Comment(by ramiy):

 ok nacin, then how about:

 {{{
 function get_search_form( $name = null) {
         do_action( 'get_search_form', $name );

         $templates = array();
         if ( isset($name) )
                 $templates[] = "searchform-{$name}.php";

         $templates[] = "searchform.php";

         // if file doesn't exist, the default search form will be
 displayed
         if ('' == locate_template($templates, true))
                 echo '<form role="search" method="get" id="searchform"
 action="' . home_url( '/' ) . '" >
                         <div><label class="screen-reader-text" for="s">' .
 __('Search for:') . '</label>
                         <input type="text" value="' . get_search_query() .
 '" name="s" id="s" />
                         <input type="submit" id="searchsubmit" value="'.
 esc_attr__('Search') .'" />
                         </div>
                         </form>';
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14851#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list