Changeset 14075
- Timestamp:
- 04/11/2010 05:26:03 PM (15 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/general-template.php
r14070 r14075 104 104 * then no template will be included. 105 105 * 106 * The template is included using require, not require_once, so you may include the 107 * same template part multiple times. 108 * 106 109 * For the parameter, if the file is called "{slug}-special.php" then specify 107 110 * "special". … … 123 126 $templates[] = "{$slug}.php"; 124 127 125 locate_template($templates, true );128 locate_template($templates, true, false); 126 129 } 127 130 -
trunk/wp-includes/theme.php
r13928 r14075 987 987 * @param array $template_names Array of template files to search for in priority order. 988 988 * @param bool $load If true the template file will be loaded if it is found. 989 * @param bool $require_once Whether to require_once or require. Default true. Has no effect if $load is false. 989 990 * @return string The template filename if one is located. 990 991 */ 991 function locate_template($template_names, $load = false ) {992 function locate_template($template_names, $load = false, $require_once = true ) { 992 993 if ( !is_array($template_names) ) 993 994 return ''; … … 1005 1006 1006 1007 if ( $load && '' != $located ) 1007 load_template( $located);1008 load_template( $located, $require_once ); 1008 1009 1009 1010 return $located; … … 1011 1012 1012 1013 /** 1013 * Require oncethe template file with WordPress environment.1014 * Require the template file with WordPress environment. 1014 1015 * 1015 1016 * The globals are set up for the template file to ensure that the WordPress … … 1020 1021 * 1021 1022 * @param string $_template_file Path to template file. 1022 */ 1023 function load_template($_template_file) { 1023 * @param bool $require_once Whether to require_once or require. Default true. 1024 */ 1025 function load_template( $_template_file, $require_once = true ) { 1024 1026 global $posts, $post, $wp_did_header, $wp_did_template_redirect, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID; 1025 1027 1026 if ( is_array($wp_query->query_vars) ) 1027 extract($wp_query->query_vars, EXTR_SKIP); 1028 1029 require_once($_template_file); 1028 if ( is_array( $wp_query->query_vars ) ) 1029 extract( $wp_query->query_vars, EXTR_SKIP ); 1030 1031 if ( $require_once ) 1032 require_once( $_template_file ); 1033 else 1034 require( $_template_file ); 1030 1035 } 1031 1036
Note: See TracChangeset
for help on using the changeset viewer.