get_template_part_{$slug}

ACTION wp-includes\general-template.php (ligne 182) github
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.

Paramètres

Entrée :
$slug, $name, $args
Sortie :
@param string      $slug The slug name for the generic template.
@param string|null $name The name of the specialized template
@param array       $args Additional arguments passed to the template.

Utilisation

// Ajouter une fonction au hook action 'get_template_part_{$slug}'
add_action('get_template_part_{$slug}', 'ma_fonction_personnalisee', 10, 1);

function ma_fonction_personnalisee($slug, $name, $args) {
    // Votre code ici
    error_log('Hook get_template_part_{$slug} déclenché');
}

Actualités

Chargement des actualités...