get_search_form from technosailor. fixes #7910

git-svn-id: http://svn.automattic.com/wordpress/trunk@9234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-10-17 20:39:56 +00:00
parent 4d2d655490
commit 76c966b75a
8 changed files with 23 additions and 29 deletions

View File

@ -63,7 +63,7 @@ get_header();
printf("<h2 class='center'>Sorry, but there aren't any posts by %s yet.</h2>", get_userdatabylogin(get_query_var('author_name'))->display_name);
else
echo("<h2 class='center'>No posts found.</h2>");
include (TEMPLATEPATH . '/searchform.php');
get_search_form();
endif;
?>

View File

@ -12,7 +12,7 @@ Template Name: Archives
<div id="content" class="widecolumn">
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
<?php get_search_form(); ?>
<h2>Archives by Month:</h2>
<ul>

View File

@ -34,7 +34,7 @@ get_header(); ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php include (TEMPLATEPATH . "/searchform.php"); ?>
<?php get_search_form(); ?>
<?php endif; ?>

View File

@ -37,7 +37,7 @@ get_header(); ?>
<?php else : ?>
<h2 class="center">No posts found. Try a different search?</h2>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
<?php get_search_form(); ?>
<?php endif; ?>

View File

@ -1,12 +0,0 @@
<?php
/**
* @package WordPress
* @subpackage Default_Theme
*/
?>
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
<label class="hidden" for="s"><?php _e('Search for:'); ?></label>
<div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>

View File

@ -9,7 +9,7 @@
<?php /* Widgetized sidebar, if you have the plugin installed. */
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
<li>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
<?php get_search_form(); ?>
</li>
<!-- Author information is disabled per default. Uncomment and fill in your details if you want to use it.

View File

@ -93,6 +93,22 @@ function get_sidebar( $name = null ) {
load_template( get_theme_root() . '/default/sidebar.php');
}
function get_search_form() {
do_action( 'get_search_form' );
if ( '' != locate_template(array('searchform.php'), true) )
return;
$form = '<form method="get" id="searchform" action="' . get_option('siteurl') . '/" >
<label class="hidden" for="s">' . __('Search for:') . '</label>
<div><input type="text" value="' . the_search_query() . '" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>';
echo apply_filters('get_search_form', $form);
}
/**
* Display the Log In/Out link.
*

View File

@ -763,21 +763,11 @@ function wp_widget_links($args) {
*/
function wp_widget_search($args) {
extract($args);
$searchform_template = get_template_directory() . '/searchform.php';
echo $before_widget;
// 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>
<input type="text" name="s" id="s" size="15" value="<?php the_search_query(); ?>" />
<input type="submit" value="<?php echo attribute_escape(__('Search')); ?>" />
</div></form>
<?php }
get_search_form();
echo $after_widget;
}