Ticket #11242: r12294.diff

File r12294.diff, 3.0 KB (added by holizz, 2 years ago)

Latest patch, without != null

  • wp-includes/template-loader.php

     
    33 * Loads the correct template based on the visitor's url 
    44 * @package WordPress 
    55 */ 
     6$template = null; 
    67if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) { 
    78        do_action('template_redirect'); 
    89        if ( is_robots() ) { 
     
    1213                do_feed(); 
    1314                return; 
    1415        } else if ( is_trackback() ) { 
    15                 include(ABSPATH . 'wp-trackback.php'); 
    16                 return; 
     16                $template = ABSPATH . 'wp-trackback.php'; 
    1717        } else if ( is_404() && $template = get_404_template() ) { 
    18                 include($template); 
    19                 return; 
    2018        } else if ( is_search() && $template = get_search_template() ) { 
    21                 include($template); 
    22                 return; 
    2319        } else if ( is_tax() && $template = get_taxonomy_template()) { 
    24                 include($template); 
    25                 return; 
    2620        } else if ( is_home() && $template = get_home_template() ) { 
    27                 include($template); 
    28                 return; 
    2921        } else if ( is_attachment() && $template = get_attachment_template() ) { 
    3022                remove_filter('the_content', 'prepend_attachment'); 
    31                 include($template); 
    32                 return; 
    3323        } else if ( is_single() && $template = get_single_template() ) { 
    34                 include($template); 
    35                 return; 
    3624        } else if ( is_page() && $template = get_page_template() ) { 
    37                 include($template); 
    38                 return; 
    3925        } else if ( is_category() && $template = get_category_template()) { 
    40                 include($template); 
    41                 return; 
    4226        } else if ( is_tag() && $template = get_tag_template()) { 
    43                 include($template); 
    44                 return; 
    4527        } else if ( is_author() && $template = get_author_template() ) { 
    46                 include($template); 
    47                 return; 
    4828        } else if ( is_date() && $template = get_date_template() ) { 
    49                 include($template); 
    50                 return; 
    5129        } else if ( is_archive() && $template = get_archive_template() ) { 
    52                 include($template); 
    53                 return; 
    5430        } else if ( is_comments_popup() && $template = get_comments_popup_template() ) { 
    55                 include($template); 
    56                 return; 
    5731        } else if ( is_paged() && $template = get_paged_template() ) { 
    58                 include($template); 
    59                 return; 
    6032        } else if ( file_exists(TEMPLATEPATH . "/index.php") ) { 
    61                 include(TEMPLATEPATH . "/index.php"); 
    62                 return; 
     33                $template = TEMPLATEPATH . "/index.php"; 
    6334        } 
    6435} else { 
    6536        // Process feeds and trackbacks even if not using themes. 
     
    7041                do_feed(); 
    7142                return; 
    7243        } else if ( is_trackback() ) { 
    73                 include(ABSPATH . 'wp-trackback.php'); 
    74                 return; 
     44                $template = ABSPATH . 'wp-trackback.php'; 
    7545        } 
    7646} 
    7747 
    78 ?> 
    79  No newline at end of file 
     48if ( $template = apply_filters('template_include', $template) ) 
     49        include($template); 
     50 
     51?> 
  • wp-includes/theme.php

     
    991991        if ( is_array($wp_query->query_vars) ) 
    992992                extract($wp_query->query_vars, EXTR_SKIP); 
    993993 
    994         require_once($_template_file); 
     994        if ( $_template_file = apply_filters('template_include',$_template_file) ) 
     995            require_once $_template_file; 
    995996} 
    996997 
    997998/**