Make WordPress Core

Changeset 8250


Ignore:
Timestamp:
07/03/2008 05:03:37 PM (18 years ago)
Author:
ryan
Message:

Use searchform.php for search widget, if available. Props ionfish. fixes #5567

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/widgets.php

    r8171 r8250  
    462462function wp_widget_search($args) {
    463463        extract($args);
    464 ?>
    465                 <?php echo $before_widget; ?>
    466                         <form id="searchform" method="get" action="<?php bloginfo('home'); ?>">
    467                         <div>
     464        $searchform_template = get_template_directory() . '/searchform.php';
     465       
     466        echo $before_widget;
     467       
     468        // Use current theme search form if it exists
     469        if ( file_exists($searchform_template) ) {
     470                include_once($searchform_template);
     471        } else { ?>
     472                <form id="searchform" method="get" action="<?php bloginfo('url'); ?>/"><div>
    468473                        <label class="hidden" for="s"><?php _e('Search for:'); ?></label>
    469                         <input type="text" name="s" id="s" size="15" /><br />
     474                        <input type="text" name="s" id="s" size="15" value="<?php the_search_query(); ?>" />
    470475                        <input type="submit" value="<?php echo attribute_escape(__('Search')); ?>" />
    471                         </div>
    472                         </form>
    473                 <?php echo $after_widget; ?>
    474 <?php
     476                </div></form>
     477        <?php }
     478       
     479        echo $after_widget;
    475480}
    476481
Note: See TracChangeset for help on using the changeset viewer.