Wordpress 2.0.2
[autoinstalls/wordpress.git] / wp-includes / template-loader.php
1 <?php
2 if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
3         do_action('template_redirect');
4         if ( is_feed() ) {
5                 include(ABSPATH . '/wp-feed.php');
6                 exit;
7         } else if ( is_trackback() ) {
8                 include(ABSPATH . '/wp-trackback.php');
9                 exit;
10         } else if ( is_404() && $template = get_404_template() ) {
11                 include($template);
12                 exit;
13         } else if ( is_search() && $template = get_search_template() ) {
14                 include($template);
15                 exit;
16         } else if ( is_home() && $template = get_home_template() ) {
17                 include($template);
18                 exit;
19         } else if ( is_attachment() && $template = get_attachment_template() ) {
20                 include($template);
21                 exit;
22         } else if ( is_single() && $template = get_single_template() ) {
23                 if ( is_attachment() )
24                         add_filter('the_content', 'prepend_attachment');
25                 include($template);
26                 exit;
27         } else if ( is_page() && $template = get_page_template() ) {
28                 if ( is_attachment() )
29                         add_filter('the_content', 'prepend_attachment');
30                 include($template);
31                 exit;
32         } else if ( is_category() && $template = get_category_template()) {
33                 include($template);
34                 exit;           
35         } else if ( is_author() && $template = get_author_template() ) {
36                 include($template);
37                 exit;
38         } else if ( is_date() && $template = get_date_template() ) {
39                 include($template);
40                 exit;
41         } else if ( is_archive() && $template = get_archive_template() ) {
42                 include($template);
43                 exit;
44         } else if ( is_comments_popup() && $template = get_comments_popup_template() ) {
45                 include($template);
46                 exit;
47         } else if ( is_paged() && $template = get_paged_template() ) {
48                 include($template);
49                 exit;
50         } else if ( file_exists(TEMPLATEPATH . "/index.php") ) {
51                 if ( is_attachment() )
52                         add_filter('the_content', 'prepend_attachment');
53                 include(TEMPLATEPATH . "/index.php");
54                 exit;
55         }
56 } else {
57         // Process feeds and trackbacks even if not using themes.
58         if ( is_feed() ) {
59                 include(ABSPATH . '/wp-feed.php');
60                 exit;
61         } else if ( is_trackback() ) {
62                 include(ABSPATH . '/wp-trackback.php');
63                 exit;
64         }
65 }
66
67 ?>