WordPress.org

Make WordPress Core

Ticket #18750: 18750.diff

File 18750.diff, 1.1 KB (added by billerickson, 3 years ago)
  • wp-includes/post-template.php

     
    12341234 * @uses $wp_query 
    12351235 * 
    12361236 * @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. 
    12371238 * @return bool False on failure, true if success. 
    12381239 */ 
    1239 function is_page_template($template = '') { 
    1240         if (!is_page()) { 
     1240function is_page_template($template = '', $id = '') { 
     1241        if ( !is_page() ) { 
    12411242                return false; 
    12421243        } 
    12431244 
    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 ); 
    12481252        $page_template = $custom_fields[0]; 
    12491253 
    12501254        // We have no argument passed so just see if a page_template has been specified