mp-wp_genesis 1 <?php
mp-wp_genesis 2 /**
mp-wp_genesis 3 * Loads the correct template based on the visitor's url
mp-wp_genesis 4 * @package WordPress
mp-wp_genesis 5 */
mp-wp_genesis 6 if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
mp-wp_genesis 7 do_action('template_redirect');
mp-wp_genesis 8 if ( is_robots() ) {
mp-wp_genesis 9 do_action('do_robots');
mp-wp_genesis 10 return;
mp-wp_genesis 11 } else if ( is_feed() ) {
mp-wp_genesis 12 do_feed();
mp-wp_genesis 13 return;
mp-wp_genesis 14 } else if ( is_trackback() ) {
mp-wp_genesis 15 include(ABSPATH . 'wp-trackback.php');
mp-wp_genesis 16 return;
mp-wp_genesis 17 } else if ( is_404() && $template = get_404_template() ) {
mp-wp_genesis 18 include($template);
mp-wp_genesis 19 return;
mp-wp_genesis 20 } else if ( is_search() && $template = get_search_template() ) {
mp-wp_genesis 21 include($template);
mp-wp_genesis 22 return;
mp-wp_genesis 23 } else if ( is_tax() && $template = get_taxonomy_template()) {
mp-wp_genesis 24 include($template);
mp-wp_genesis 25 return;
mp-wp_genesis 26 } else if ( is_home() && $template = get_home_template() ) {
mp-wp_genesis 27 include($template);
mp-wp_genesis 28 return;
mp-wp_genesis 29 } else if ( is_attachment() && $template = get_attachment_template() ) {
mp-wp_genesis 30 remove_filter('the_content', 'prepend_attachment');
mp-wp_genesis 31 include($template);
mp-wp_genesis 32 return;
mp-wp_genesis 33 } else if ( is_single() && $template = get_single_template() ) {
mp-wp_genesis 34 include($template);
mp-wp_genesis 35 return;
mp-wp_genesis 36 } else if ( is_page() && $template = get_page_template() ) {
mp-wp_genesis 37 include($template);
mp-wp_genesis 38 return;
mp-wp_genesis 39 } else if ( is_category() && $template = get_category_template()) {
mp-wp_genesis 40 include($template);
mp-wp_genesis 41 return;
mp-wp_genesis 42 } else if ( is_tag() && $template = get_tag_template()) {
mp-wp_genesis 43 include($template);
mp-wp_genesis 44 return;
mp-wp_genesis 45 } else if ( is_author() && $template = get_author_template() ) {
mp-wp_genesis 46 include($template);
mp-wp_genesis 47 return;
mp-wp_genesis 48 } else if ( is_date() && $template = get_date_template() ) {
mp-wp_genesis 49 include($template);
mp-wp_genesis 50 return;
mp-wp_genesis 51 } else if ( is_archive() && $template = get_archive_template() ) {
mp-wp_genesis 52 include($template);
mp-wp_genesis 53 return;
mp-wp_genesis 54 } else if ( is_comments_popup() && $template = get_comments_popup_template() ) {
mp-wp_genesis 55 include($template);
mp-wp_genesis 56 return;
mp-wp_genesis 57 } else if ( is_paged() && $template = get_paged_template() ) {
mp-wp_genesis 58 include($template);
mp-wp_genesis 59 return;
mp-wp_genesis 60 } else if ( file_exists(TEMPLATEPATH . "/index.php") ) {
mp-wp_genesis 61 include(TEMPLATEPATH . "/index.php");
mp-wp_genesis 62 return;
mp-wp_genesis 63 }
mp-wp_genesis 64 } else {
mp-wp_genesis 65 // Process feeds and trackbacks even if not using themes.
mp-wp_genesis 66 if ( is_robots() ) {
mp-wp_genesis 67 do_action('do_robots');
mp-wp_genesis 68 return;
mp-wp_genesis 69 } else if ( is_feed() ) {
mp-wp_genesis 70 do_feed();
mp-wp_genesis 71 return;
mp-wp_genesis 72 } else if ( is_trackback() ) {
mp-wp_genesis 73 include(ABSPATH . 'wp-trackback.php');
mp-wp_genesis 74 return;
mp-wp_genesis 75 }
mp-wp_genesis 76 }
mp-wp_genesis 77
mp-wp_genesis 78 ?>