3 * Loads the correct template based on the visitor's url
6 if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
7 do_action('template_redirect');
9 do_action('do_robots');
11 } else if ( is_feed() ) {
14 } else if ( is_trackback() ) {
15 include(ABSPATH . 'wp-trackback.php');
17 } else if ( is_404() && $template = get_404_template() ) {
20 } else if ( is_search() && $template = get_search_template() ) {
23 } else if ( is_tax() && $template = get_taxonomy_template()) {
26 } else if ( is_home() && $template = get_home_template() ) {
29 } else if ( is_attachment() && $template = get_attachment_template() ) {
30 remove_filter('the_content', 'prepend_attachment');
33 } else if ( is_single() && $template = get_single_template() ) {
36 } else if ( is_page() && $template = get_page_template() ) {
39 } else if ( is_category() && $template = get_category_template()) {
42 } else if ( is_tag() && $template = get_tag_template()) {
45 } else if ( is_author() && $template = get_author_template() ) {
48 } else if ( is_date() && $template = get_date_template() ) {
51 } else if ( is_archive() && $template = get_archive_template() ) {
54 } else if ( is_comments_popup() && $template = get_comments_popup_template() ) {
57 } else if ( is_paged() && $template = get_paged_template() ) {
60 } else if ( file_exists(TEMPLATEPATH . "/index.php") ) {
61 include(TEMPLATEPATH . "/index.php");
65 // Process feeds and trackbacks even if not using themes.
67 do_action('do_robots');
69 } else if ( is_feed() ) {
72 } else if ( is_trackback() ) {
73 include(ABSPATH . 'wp-trackback.php');