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

git-svn-id: https://develop.svn.wordpress.org/trunk@2302 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2005-02-13 20:32:24 +00:00
parent 4b80a070e7
commit 2cee4ac87f
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;