Ticket #23202: 23202.alt.patch
File 23202.alt.patch, 1.1 KB (added by , 11 years ago) |
---|
-
post-template.php
1253 1253 * @uses $wp_query 1254 1254 * 1255 1255 * @param string $template The specific template name if specific matching is required. 1256 * @param bool $loop Whether is_page_template() should be available in the loop. 1256 1257 * @return bool True on success, false on failure. 1257 1258 */ 1258 function is_page_template( $template = '' ) { 1259 if ( ! is_page() ) 1259 function is_page_template( $template = '', $loop = false ) { 1260 // Bail if (1) not a page and not in the loop or (2) in loop and not available in loop 1261 if ( ( ! is_page() && ! in_the_loop() ) || ( in_the_loop() && ! $loop ) ) 1260 1262 return false; 1263 1264 if ( in_the_loop() ) { 1265 global $wp_the_query; 1266 $page_template = get_page_template_slug( $wp_the_query->queried_object_id ); 1267 } else { 1268 $page_template = get_page_template_slug( get_queried_object_id() ); 1269 } 1261 1270 1262 $page_template = get_page_template_slug( get_queried_object_id() );1263 1264 1271 if ( empty( $template ) ) 1265 1272 return (bool) $page_template; 1266 1273