Template redirection.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f3cf5ba8c9
commit
841e29798b
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
if (! isset($wp_did_header)):
|
||||
if ( !file_exists( dirname(__FILE__) . '/wp-config.php') )
|
||||
die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://wordpress.org/docs/faq/#wp-config'>We got it</a>. You can <a href='wp-admin/setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.");
|
||||
|
||||
|
@ -159,13 +160,50 @@ if (1 == count($posts)) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($pagenow != 'wp-feed.php' && $feed != '') {
|
||||
require(dirname(__FILE__) . '/wp-feed.php');
|
||||
exit;
|
||||
}
|
||||
$wp_did_header = true;
|
||||
endif;
|
||||
|
||||
if ($pagenow != 'wp-trackback.php' && $tb == 1) {
|
||||
require(dirname(__FILE__) . '/wp-trackback.php');
|
||||
// Template redirection
|
||||
if (is_single() && (! isset($wp_did_single)) &&
|
||||
file_exists(ABSPATH . 'wp-content/single.php')) {
|
||||
$wp_did_single = true;
|
||||
include(ABSPATH . 'wp-content/single.php');
|
||||
exit;
|
||||
} else if (is_page() && (! isset($wp_did_page)) &&
|
||||
file_exists(ABSPATH . 'wp-content/page.php')) {
|
||||
$wp_did_page = true;
|
||||
include(ABSPATH . 'wp-content/page.php');
|
||||
exit;
|
||||
} else if (is_category() && (! isset($wp_did_category)) &&
|
||||
file_exists(ABSPATH . 'wp-content/category.php')) {
|
||||
$wp_did_category = true;
|
||||
include(ABSPATH . 'wp-content/category.php');
|
||||
exit;
|
||||
} else if (is_author() && (! isset($wp_did_author)) &&
|
||||
file_exists(ABSPATH . 'wp-content/author.php')) {
|
||||
$wp_did_author = true;
|
||||
include(ABSPATH . 'wp-content/author.php');
|
||||
exit;
|
||||
} else if (is_date() && (! isset($wp_did_date)) &&
|
||||
file_exists(ABSPATH . 'wp-content/date.php')) {
|
||||
$wp_did_date = true;
|
||||
include(ABSPATH . 'wp-content/date.php');
|
||||
exit;
|
||||
} else if (is_archive() && (! isset($wp_did_archive)) &&
|
||||
file_exists(ABSPATH . 'wp-content/archive.php')) {
|
||||
$wp_did_archive = true;
|
||||
include(ABSPATH . 'wp-content/archive.php');
|
||||
exit;
|
||||
} else if (is_search() && (! isset($wp_did_search)) &&
|
||||
file_exists(ABSPATH . 'wp-content/search.php')) {
|
||||
$wp_did_search = true;
|
||||
include(ABSPATH . 'wp-content/search.php');
|
||||
exit;
|
||||
} else if (is_feed() && $pagenow != 'wp-feed.php') {
|
||||
include(dirname(__FILE__) . '/wp-feed.php');
|
||||
exit;
|
||||
} else if ($pagenow != 'wp-trackback.php' && $tb == 1) {
|
||||
include(dirname(__FILE__) . '/wp-trackback.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ class WP_Query {
|
|||
var $post;
|
||||
|
||||
var $is_single = false;
|
||||
var $is_page = false;
|
||||
var $is_archive = false;
|
||||
var $is_date = false;
|
||||
var $is_year = false;
|
||||
|
@ -24,6 +25,7 @@ class WP_Query {
|
|||
|
||||
function init () {
|
||||
$this->is_single = false;
|
||||
$this->is_page = false;
|
||||
$this->is_archive = false;
|
||||
$this->is_date = false;
|
||||
$this->is_year = false;
|
||||
|
@ -152,15 +154,18 @@ class WP_Query {
|
|||
|
||||
if ('' != $qv['feed']) {
|
||||
$this->is_feed = true;
|
||||
$this->feed = $qv['feed'];
|
||||
}
|
||||
|
||||
if ('' != $qv['static'] || '' != $qv['pagename']) {
|
||||
$this->is_page = true;
|
||||
}
|
||||
|
||||
if ( ($this->is_date || $this->is_author || $this->is_category)
|
||||
&& (! $this->is_single)) {
|
||||
&& (! ($this->is_single || $this->is_page)) ) {
|
||||
$this->is_archive = true;
|
||||
}
|
||||
|
||||
if ( ! ($this->is_archive || $this->is_single || $this->is_search || $this->is_feed)) {
|
||||
if ( ! ($this->is_archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed)) {
|
||||
$this->is_home = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1590,6 +1590,12 @@ function is_single () {
|
|||
return $wp_query->is_single;
|
||||
}
|
||||
|
||||
function is_page () {
|
||||
global $wp_query;
|
||||
|
||||
return $wp_query->is_page;
|
||||
}
|
||||
|
||||
function is_archive () {
|
||||
global $wp_query;
|
||||
|
||||
|
|
Loading…
Reference in New Issue