akcjadynamicznyod 3.0.0
get_template_part_{$slug}
Args 3Plik wp-includes/general-template.php
Opis — z kodu źródłowego
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.
Parametry
| Parametr | Typ | Opis |
|---|---|---|
$slug | string | The slug name for the generic template. |
$name | string | null | The name of the specialized template or null if there is none. |
$args | array | Additional arguments passed to the template. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_action( 'get_template_part_{$slug}', 'twoja_funkcja', 10, 3 );
function twoja_funkcja($param_1, $param_2, $param_3) {
// Twój kod
}
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_action( 'get_template_part_{$slug}', 'twoja_funkcja', 10, 3 );
function twoja_funkcja($param_1, $param_2, $param_3) {
// Twój kod
}Popularne w tej kategorii