Changeset 1558

Show
Ignore:
Timestamp:
08/24/04 08:43:01 (4 years ago)
Author:
rboren
Message:

Template redirection.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-blog-header.php

    r1536 r1558  
    11<?php 
    22 
     3if (! isset($wp_did_header)): 
    34if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) 
    45    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."); 
     
    160161} 
    161162 
    162 if ($pagenow != 'wp-feed.php' && $feed != '') { 
    163     require(dirname(__FILE__) . '/wp-feed.php'); 
    164     exit; 
    165 
    166  
    167 if ($pagenow != 'wp-trackback.php' && $tb == 1) { 
    168     require(dirname(__FILE__) . '/wp-trackback.php'); 
    169     exit; 
     163$wp_did_header = true; 
     164endif; 
     165 
     166// Template redirection 
     167if (is_single() && (! isset($wp_did_single)) && 
     168    file_exists(ABSPATH . 'wp-content/single.php')) { 
     169  $wp_did_single = true; 
     170  include(ABSPATH . 'wp-content/single.php'); 
     171  exit; 
     172} else if (is_page() && (! isset($wp_did_page)) && 
     173        file_exists(ABSPATH . 'wp-content/page.php')) { 
     174  $wp_did_page = true; 
     175  include(ABSPATH . 'wp-content/page.php'); 
     176  exit; 
     177} else if (is_category() && (! isset($wp_did_category)) && 
     178       file_exists(ABSPATH . 'wp-content/category.php')) { 
     179  $wp_did_category = true; 
     180  include(ABSPATH . 'wp-content/category.php'); 
     181  exit; 
     182} else if (is_author() && (! isset($wp_did_author)) && 
     183       file_exists(ABSPATH . 'wp-content/author.php')) { 
     184  $wp_did_author = true; 
     185  include(ABSPATH . 'wp-content/author.php'); 
     186  exit; 
     187} else if (is_date() && (! isset($wp_did_date)) && 
     188       file_exists(ABSPATH . 'wp-content/date.php')) { 
     189  $wp_did_date = true; 
     190  include(ABSPATH . 'wp-content/date.php'); 
     191  exit; 
     192} else if (is_archive() && (! isset($wp_did_archive)) && 
     193       file_exists(ABSPATH . 'wp-content/archive.php')) { 
     194  $wp_did_archive = true; 
     195  include(ABSPATH . 'wp-content/archive.php'); 
     196  exit; 
     197} else if (is_search() && (! isset($wp_did_search)) && 
     198       file_exists(ABSPATH . 'wp-content/search.php')) { 
     199  $wp_did_search = true; 
     200  include(ABSPATH . 'wp-content/search.php'); 
     201  exit; 
     202} else if (is_feed() && $pagenow != 'wp-feed.php') { 
     203  include(dirname(__FILE__) . '/wp-feed.php'); 
     204  exit; 
     205} else if ($pagenow != 'wp-trackback.php' && $tb == 1) { 
     206  include(dirname(__FILE__) . '/wp-trackback.php'); 
     207  exit; 
    170208} 
    171209 
  • trunk/wp-includes/classes.php

    r1556 r1558  
    1111 
    1212    var $is_single = false; 
     13    var $is_page = false; 
    1314    var $is_archive = false; 
    1415    var $is_date = false; 
     
    2526    function init () { 
    2627        $this->is_single = false; 
     28        $this->is_page = false; 
    2729        $this->is_archive = false; 
    2830        $this->is_date = false; 
     
    153155        if ('' != $qv['feed']) { 
    154156            $this->is_feed = true; 
    155             $this->feed = $qv['feed']; 
     157        } 
     158 
     159        if ('' != $qv['static'] || '' != $qv['pagename']) { 
     160            $this->is_page = true; 
    156161        } 
    157162 
    158163        if ( ($this->is_date || $this->is_author || $this->is_category) 
    159              && (! $this->is_single)) { 
     164             && (! ($this->is_single || $this->is_page)) ) { 
    160165            $this->is_archive = true; 
    161166        } 
    162167 
    163         if ( ! ($this->is_archive || $this->is_single || $this->is_search || $this->is_feed)) { 
     168        if ( ! ($this->is_archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed)) { 
    164169            $this->is_home = true; 
    165170        } 
  • trunk/wp-includes/functions.php

    r1556 r1558  
    15911591} 
    15921592 
     1593function is_page () { 
     1594    global $wp_query; 
     1595 
     1596    return $wp_query->is_page; 
     1597} 
     1598 
    15931599function is_archive () { 
    15941600    global $wp_query;