Changeset 48370 for trunk/src/wp-includes/template.php
- Timestamp:
- 07/07/2020 11:00:21 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/template.php
r47808 r48370 645 645 * 646 646 * @since 2.7.0 647 * @since 5.5.0 The `$args` parameter was added. 647 648 * 648 649 * @param string|array $template_names Template file(s) to search for, in order. 649 650 * @param bool $load If true the template file will be loaded if it is found. 650 * @param bool $require_once Whether to require_once or require. Default true. Has no effect if $load is false. 651 * @param bool $require_once Whether to require_once or require. Has no effect if `$load` is false. 652 * Default true. 653 * @param array $args Optional. Additional arguments passed to the template. 654 * Default empty array. 651 655 * @return string The template filename if one is located. 652 656 */ 653 function locate_template( $template_names, $load = false, $require_once = true ) {657 function locate_template( $template_names, $load = false, $require_once = true, $args = array() ) { 654 658 $located = ''; 655 659 foreach ( (array) $template_names as $template_name ) { … … 670 674 671 675 if ( $load && '' !== $located ) { 672 load_template( $located, $require_once );676 load_template( $located, $require_once, $args ); 673 677 } 674 678 … … 684 688 * 685 689 * @since 1.5.0 690 * @since 5.5.0 The `$args` parameter was added. 686 691 * 687 692 * @global array $posts … … 699 704 * @param string $_template_file Path to template file. 700 705 * @param bool $require_once Whether to require_once or require. Default true. 701 */ 702 function load_template( $_template_file, $require_once = true ) { 706 * @param array $args Optional. Additional arguments passed to the template. 707 * Default empty array. 708 */ 709 function load_template( $_template_file, $require_once = true, $args = array() ) { 703 710 global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID; 704 711
Note: See TracChangeset
for help on using the changeset viewer.