Wordpress 2.3.2-scripts
[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_robots() ) {
5                 do_action('do_robots');
6                 return;
7         } else if ( is_feed() ) {
8                 do_feed();
9                 return;
10         } else if ( is_trackback() ) {
11                 include(ABSPATH . 'wp-trackback.php');
12                 return;
13         } else if ( is_404() && $template = get_404_template() ) {
14                 include($template);
15                 return;
16         } else if ( is_search() && $template = get_search_template() ) {
17                 include($template);
18                 return;
19         } else if ( is_home() && $template = get_home_template() ) {
20                 include($template);
21                 return;
22         } else if ( is_attachment() && $template = get_attachment_template() ) {
23                 include($template);
24                 return;
25         } else if ( is_single() && $template = get_single_template() ) {
26                 if ( is_attachment() )
27                         add_filter('the_content', 'prepend_attachment');
28                 include($template);
29                 return;
30         } else if ( is_page() && $template = get_page_template() ) {
31                 if ( is_attachment() )
32                         add_filter('the_content', 'prepend_attachment');
33                 include($template);
34                 return;
35         } else if ( is_category() && $template = get_category_template()) {
36                 include($template);
37                 return;
38         } else if ( is_tag() && $template = get_tag_template()) {
39                 include($template);
40                 return;
41         } else if ( is_author() && $template = get_author_template() ) {
42                 include($template);
43                 return;
44         } else if ( is_date() && $template = get_date_template() ) {
45                 include($template);
46                 return;
47         } else if ( is_archive() && $template = get_archive_template() ) {
48                 include($template);
49                 return;
50         } else if ( is_comments_popup() && $template = get_comments_popup_template() ) {
51                 include($template);
52                 return;
53         } else if ( is_paged() && $template = get_paged_template() ) {
54                 include($template);
55                 return;
56         } else if ( file_exists(TEMPLATEPATH . "/index.php") ) {
57                 if ( is_attachment() )
58                         add_filter('the_content', 'prepend_attachment');
59                 include(TEMPLATEPATH . "/index.php");
60                 return;
61         }
62 } else {
63         // Process feeds and trackbacks even if not using themes.
64         if ( is_robots() ) {
65                 do_action('do_robots');
66                 return;
67         } else if ( is_feed() ) {
68                 do_feed();
69                 return;
70         } else if ( is_trackback() ) {
71                 include(ABSPATH . 'wp-trackback.php');
72                 return;
73         }
74 }
75
76 ?>