get_template_part_(slug)
Fires before the specified template part file is loaded.
The dynamic portion of the hook name, $slug, refers to the slug name for the generic template part.
Использование
add_action( 'get_template_part_(slug)', 'wp_kama_get_template_part_slug_action', 10, 3 ); /** * Function for `get_template_part_(slug)` action-hook. * * @param string $slug The slug name for the generic template. * @param string|null $name The name of the specialized template or null if there is none. * @param array $args Additional arguments passed to the template. * * @return void */ function wp_kama_get_template_part_slug_action( $slug, $name, $args ){ // action... }
- $slug(строка)
- The slug name for the generic template.
- $name(строка|null)
- The name of the specialized template or null if there is none.
- $args(массив)
- Additional arguments passed to the template.
Список изменений
С версии 3.0.0 | Введена. |
С версии 5.5.0 | The $args parameter was added. |
Где вызывается хук
get_template_part_(slug)
wp-includes/general-template.php 182
do_action( "get_template_part_{$slug}", $slug, $name, $args );