get_template_part
Fires before an attempt is made to locate and load a template part.
Использование
add_action( 'get_template_part', 'wp_kama_get_template_part_action', 10, 4 ); /** * Function for `get_template_part` action-hook. * * @param string $slug The slug name for the generic template. * @param string $name The name of the specialized template or an empty string if there is none. * @param string[] $templates Array of template files to search for, in order. * @param array $args Additional arguments passed to the template. * * @return void */ function wp_kama_get_template_part_action( $slug, $name, $templates, $args ){ // action... }
- $slug(строка)
- The slug name for the generic template.
- $name(строка)
- The name of the specialized template or an empty string if there is none.
- $templates(string[])
- Array of template files to search for, in order.
- $args(массив)
- Additional arguments passed to the template.
Список изменений
С версии 5.2.0 | Введена. |
С версии 5.5.0 | The $args parameter was added. |
Где вызывается хук
get_template_part
wp-includes/general-template.php 204
do_action( 'get_template_part', $slug, $name, $templates, $args );