IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 346 | 346 | * @param string|array $template_names Template file(s) to search for, in order. |
| 347 | 347 | * @param bool $load If true the template file will be loaded if it is found. |
| 348 | 348 | * @param bool $require_once Whether to require_once or require. Default true. Has no effect if $load is false. |
| | 349 | * @param mixed $data An array of arguments to be extracted into current scope in load_template. |
| 349 | 350 | * @return string The template filename if one is located. |
| 350 | 351 | */ |
| 351 | | function locate_template($template_names, $load = false, $require_once = true ) { |
| | 352 | function locate_template($template_names, $load = false, $require_once = true, $data = array()) { |
| 352 | 353 | $located = ''; |
| 353 | 354 | foreach ( (array) $template_names as $template_name ) { |
| 354 | 355 | if ( !$template_name ) |
| … |
… |
|
| 363 | 364 | } |
| 364 | 365 | |
| 365 | 366 | if ( $load && '' != $located ) |
| 366 | | load_template( $located, $require_once ); |
| | 367 | load_template( $located, $require_once, $data ); |
| 367 | 368 | |
| 368 | 369 | return $located; |
| 369 | 370 | } |
| … |
… |
|
| 379 | 380 | * |
| 380 | 381 | * @param string $_template_file Path to template file. |
| 381 | 382 | * @param bool $require_once Whether to require_once or require. Default true. |
| | 383 | * @param array $_data An array of arguments to be extracted into current scope. |
| 382 | 384 | */ |
| 383 | | function load_template( $_template_file, $require_once = true ) { |
| | 385 | function load_template( $_template_file, $require_once = true, $_data = array() ) { |
| 384 | 386 | global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID; |
| 385 | 387 | |
| 386 | 388 | if ( is_array( $wp_query->query_vars ) ) |
| 387 | 389 | extract( $wp_query->query_vars, EXTR_SKIP ); |
| | 390 | |
| | 391 | extract( $_data, EXTR_SKIP ); |
| 388 | 392 | |
| 389 | 393 | if ( $require_once ) |
| 390 | 394 | require_once( $_template_file ); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 115 | 115 | * |
| 116 | 116 | * @param string $slug The slug name for the generic template. |
| 117 | 117 | * @param string $name The name of the specialised template. |
| | 118 | * @param mixed $data An array of arguments to be extracted into current scope in load_template. |
| 118 | 119 | */ |
| 119 | | function get_template_part( $slug, $name = null ) { |
| 120 | | do_action( "get_template_part_{$slug}", $slug, $name ); |
| | 120 | function get_template_part( $slug, $name = null, $data = array() ) { |
| | 121 | do_action( "get_template_part_{$slug}", $slug, $name, $data ); |
| 121 | 122 | |
| 122 | 123 | $templates = array(); |
| 123 | 124 | if ( isset($name) ) |
| … |
… |
|
| 125 | 126 | |
| 126 | 127 | $templates[] = "{$slug}.php"; |
| 127 | 128 | |
| 128 | | locate_template($templates, true, false); |
| | 129 | locate_template($templates, true, false, $data); |
| 129 | 130 | } |
| 130 | 131 | |
| 131 | 132 | /** |