Ticket #18750: 18750.diff
| File 18750.diff, 1.1 KB (added by , 15 years ago) |
|---|
-
wp-includes/post-template.php
1234 1234 * @uses $wp_query 1235 1235 * 1236 1236 * @param string $template The specific template name if specific matching is required. 1237 * @param string $id The ID of the page you'd like to check. Leave blank to use current page. 1237 1238 * @return bool False on failure, true if success. 1238 1239 */ 1239 function is_page_template($template = '' ) {1240 if ( !is_page()) {1240 function is_page_template($template = '', $id = '') { 1241 if ( !is_page() ) { 1241 1242 return false; 1242 1243 } 1243 1244 1244 global $wp_query; 1245 1246 $page = $wp_query->get_queried_object(); 1247 $custom_fields = get_post_custom_values('_wp_page_template',$page->ID); 1245 if( empty( $id ) ) { 1246 global $wp_query; 1247 $page = $wp_query->get_queried_object(); 1248 $id = $page->ID; 1249 } 1250 1251 $custom_fields = get_post_custom_values( '_wp_page_template', $id ); 1248 1252 $page_template = $custom_fields[0]; 1249 1253 1250 1254 // We have no argument passed so just see if a page_template has been specified