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

git-svn-id: https://develop.svn.wordpress.org/trunk@8250 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-07-03 17:03:37 +00:00
parent 687c6014d3
commit 5ffc4fbcef

View File

@ -461,17 +461,22 @@ function wp_widget_links($args) {
function wp_widget_search($args) { function wp_widget_search($args) {
extract($args); extract($args);
?> $searchform_template = get_template_directory() . '/searchform.php';
<?php echo $before_widget; ?>
<form id="searchform" method="get" action="<?php bloginfo('home'); ?>"> echo $before_widget;
<div>
// Use current theme search form if it exists
if ( file_exists($searchform_template) ) {
include_once($searchform_template);
} else { ?>
<form id="searchform" method="get" action="<?php bloginfo('url'); ?>/"><div>
<label class="hidden" for="s"><?php _e('Search for:'); ?></label> <label class="hidden" for="s"><?php _e('Search for:'); ?></label>
<input type="text" name="s" id="s" size="15" /><br /> <input type="text" name="s" id="s" size="15" value="<?php the_search_query(); ?>" />
<input type="submit" value="<?php echo attribute_escape(__('Search')); ?>" /> <input type="submit" value="<?php echo attribute_escape(__('Search')); ?>" />
</div> </div></form>
</form> <?php }
<?php echo $after_widget; ?>
<?php echo $after_widget;
} }
function wp_widget_archives($args) { function wp_widget_archives($args) {