Changeset 45590 for trunk/src/wp-includes/template-loader.php
- Timestamp:
- 07/02/2019 11:41:16 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/template-loader.php
r44966 r45590 29 29 30 30 // Process feeds and trackbacks even if not using themes. 31 if ( is_robots() ) :31 if ( is_robots() ) { 32 32 /** 33 33 * Fired when the template loader determines a robots.txt request. … … 37 37 do_action( 'do_robots' ); 38 38 return; 39 elseif ( is_feed() ) : 39 } elseif ( is_feed() ) { 40 40 do_feed(); 41 41 return; 42 elseif ( is_trackback() ) : 42 } elseif ( is_trackback() ) { 43 43 include( ABSPATH . 'wp-trackback.php' ); 44 44 return; 45 endif; 45 } 46 46 47 if ( wp_using_themes() ) : 48 $template = false; 49 if ( is_embed() && $template = get_embed_template() ) : 50 elseif ( is_404() && $template = get_404_template() ) : 51 elseif ( is_search() && $template = get_search_template() ) : 52 elseif ( is_front_page() && $template = get_front_page_template() ) : 53 elseif ( is_home() && $template = get_home_template() ) : 54 elseif ( is_privacy_policy() && $template = get_privacy_policy_template() ) : 55 elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) : 56 elseif ( is_tax() && $template = get_taxonomy_template() ) : 57 elseif ( is_attachment() && $template = get_attachment_template() ) : 58 remove_filter( 'the_content', 'prepend_attachment' ); 59 elseif ( is_single() && $template = get_single_template() ) : 60 elseif ( is_page() && $template = get_page_template() ) : 61 elseif ( is_singular() && $template = get_singular_template() ) : 62 elseif ( is_category() && $template = get_category_template() ) : 63 elseif ( is_tag() && $template = get_tag_template() ) : 64 elseif ( is_author() && $template = get_author_template() ) : 65 elseif ( is_date() && $template = get_date_template() ) : 66 elseif ( is_archive() && $template = get_archive_template() ) : 67 else : 47 if ( wp_using_themes() ) { 48 49 $tag_templates = array( 50 'is_embed' => 'get_embed_template', 51 'is_404' => 'get_404_template', 52 'is_search' => 'get_search_template', 53 'is_front_page' => 'get_front_page_template', 54 'is_home' => 'get_home_template', 55 'is_privacy_policy' => 'get_privacy_policy_template', 56 'is_post_type_archive' => 'get_post_type_archive_template', 57 'is_tax' => 'get_taxonomy_template', 58 'is_attachment' => 'get_attachment_template', 59 'is_single' => 'get_single_template', 60 'is_page' => 'get_page_template', 61 'is_singular' => 'get_singular_template', 62 'is_category' => 'get_category_template', 63 'is_tag' => 'get_tag_template', 64 'is_author' => 'get_author_template', 65 'is_date' => 'get_date_template', 66 'is_archive' => 'get_archive_template', 67 ); 68 $template = false; 69 70 // Loop through each of the template conditionals, and find the appropriate template file. 71 foreach ( $tag_templates as $tag => $template_getter ) { 72 if ( call_user_func( $tag ) ) { 73 $template = call_user_func( $template_getter ); 74 } 75 76 if ( $template ) { 77 if ( 'is_attachment' === $tag ) { 78 remove_filter( 'the_content', 'prepend_attachment' ); 79 } 80 81 break; 82 } 83 } 84 85 if ( ! $template ) { 68 86 $template = get_index_template(); 69 endif; 87 } 88 70 89 /** 71 90 * Filters the path of the current template before including it. … … 75 94 * @param string $template The path of the template to include. 76 95 */ 77 if ( $template = apply_filters( 'template_include', $template ) ) { 96 $template = apply_filters( 'template_include', $template ); 97 if ( $template ) { 78 98 include( $template ); 79 99 } elseif ( current_user_can( 'switch_themes' ) ) { … … 84 104 } 85 105 return; 86 endif; 106 }
Note: See TracChangeset
for help on using the changeset viewer.