Don't redirect to permalink page if search returns one result. Move search template load higher up in load order.

git-svn-id: http://svn.automattic.com/wordpress/trunk@2302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2005-02-13 20:32:24 +00:00
parent a266c82c47
commit 9c4632e9f6
1 changed files with 5 additions and 10 deletions

View File

@ -166,13 +166,8 @@ $posts = query_posts($query_string);
extract($wp_query->query_vars);
if (1 == count($posts)) {
if (is_single()) {
$more = 1;
$single = 1;
}
if ( $s && empty($paged) && !strstr($_SERVER['PHP_SELF'], 'wp-admin/')) { // If they were doing a search and got one result
header('Location: ' . get_permalink($posts[0]->ID));
}
$more = 1;
$single = 1;
}
// Issue a 404 if a permalink request doesn't match any posts. Don't issue a
@ -218,6 +213,9 @@ if ($pagenow == 'index.php') {
} else if ( is_404() && get_404_template() ) {
include(get_404_template());
exit;
} else if ( is_search() && get_search_template() ) {
include(get_search_template());
exit;
} else if ( is_home() && get_home_template() ) {
include(get_home_template());
exit;
@ -239,9 +237,6 @@ if ($pagenow == 'index.php') {
} else if ( is_archive() && get_archive_template() ) {
include(get_archive_template());
exit;
} else if ( is_search() && get_search_template() ) {
include(get_search_template());
exit;
} else if ( is_paged() && get_paged_template() ) {
include(get_paged_template());
exit;