Template redirection.
git-svn-id: https://develop.svn.wordpress.org/trunk@1558 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6c12d408ec
commit
8da2215076
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
if (! isset($wp_did_header)):
|
||||||
if ( !file_exists( dirname(__FILE__) . '/wp-config.php') )
|
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.");
|
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 != '') {
|
$wp_did_header = true;
|
||||||
require(dirname(__FILE__) . '/wp-feed.php');
|
endif;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($pagenow != 'wp-trackback.php' && $tb == 1) {
|
// Template redirection
|
||||||
require(dirname(__FILE__) . '/wp-trackback.php');
|
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;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ class WP_Query {
|
|||||||
var $post;
|
var $post;
|
||||||
|
|
||||||
var $is_single = false;
|
var $is_single = false;
|
||||||
|
var $is_page = false;
|
||||||
var $is_archive = false;
|
var $is_archive = false;
|
||||||
var $is_date = false;
|
var $is_date = false;
|
||||||
var $is_year = false;
|
var $is_year = false;
|
||||||
@ -24,6 +25,7 @@ class WP_Query {
|
|||||||
|
|
||||||
function init () {
|
function init () {
|
||||||
$this->is_single = false;
|
$this->is_single = false;
|
||||||
|
$this->is_page = false;
|
||||||
$this->is_archive = false;
|
$this->is_archive = false;
|
||||||
$this->is_date = false;
|
$this->is_date = false;
|
||||||
$this->is_year = false;
|
$this->is_year = false;
|
||||||
@ -152,15 +154,18 @@ class WP_Query {
|
|||||||
|
|
||||||
if ('' != $qv['feed']) {
|
if ('' != $qv['feed']) {
|
||||||
$this->is_feed = true;
|
$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)
|
if ( ($this->is_date || $this->is_author || $this->is_category)
|
||||||
&& (! $this->is_single)) {
|
&& (! ($this->is_single || $this->is_page)) ) {
|
||||||
$this->is_archive = true;
|
$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;
|
$this->is_home = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1590,6 +1590,12 @@ function is_single () {
|
|||||||
return $wp_query->is_single;
|
return $wp_query->is_single;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function is_page () {
|
||||||
|
global $wp_query;
|
||||||
|
|
||||||
|
return $wp_query->is_page;
|
||||||
|
}
|
||||||
|
|
||||||
function is_archive () {
|
function is_archive () {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user