WordPress.org

Make WordPress Core

Ticket #21676: 21676.patch

File 21676.patch, 2.7 KB (added by sc0ttkclark, 3 years ago)
  • trunk/wp-includes/template.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    346346 * @param string|array $template_names Template file(s) to search for, in order. 
    347347 * @param bool $load If true the template file will be loaded if it is found. 
    348348 * @param bool $require_once Whether to require_once or require. Default true. Has no effect if $load is false. 
     349 * @param mixed $data Any type of variable to pass to the template. 
    349350 * @return string The template filename if one is located. 
    350351 */ 
    351 function locate_template($template_names, $load = false, $require_once = true ) { 
     352function locate_template($template_names, $load = false, $require_once = true, $data = null) { 
    352353        $located = ''; 
    353354        foreach ( (array) $template_names as $template_name ) { 
    354355                if ( !$template_name ) 
     
    363364        } 
    364365 
    365366        if ( $load && '' != $located ) 
    366                 load_template( $located, $require_once ); 
     367                load_template( $located, $require_once, $data ); 
    367368 
    368369        return $located; 
    369370} 
     
    379380 * 
    380381 * @param string $_template_file Path to template file. 
    381382 * @param bool $require_once Whether to require_once or require. Default true. 
     383 * @param mixed $_data Any type of variable to pass to the template. 
    382384 */ 
    383 function load_template( $_template_file, $require_once = true ) { 
     385function load_template( $_template_file, $require_once = true, $_data = null ) { 
    384386        global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID; 
    385387 
    386388        if ( is_array( $wp_query->query_vars ) ) 
  • trunk/wp-includes/general-template.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    115115 * 
    116116 * @param string $slug The slug name for the generic template. 
    117117 * @param string $name The name of the specialised template. 
     118 * @param mixed $data Any type of variable to pass to the template. 
    118119 */ 
    119 function get_template_part( $slug, $name = null ) { 
    120         do_action( "get_template_part_{$slug}", $slug, $name ); 
     120function get_template_part( $slug, $name = null, $data = null ) { 
     121        do_action( "get_template_part_{$slug}", $slug, $name, $data ); 
    121122 
    122123        $templates = array(); 
    123124        if ( isset($name) ) 
     
    125126 
    126127        $templates[] = "{$slug}.php"; 
    127128 
    128         locate_template($templates, true, false); 
     129        locate_template($templates, true, false, $data); 
    129130} 
    130131 
    131132/**