akcjaod 3.0.0
after_setup_theme
Opis
Uruchamiany po inicjalizacji motywu, jeszcze przed hookiem init. Standardowe miejsce na add_theme_support() i register_nav_menus().
Przykład użycia
add_action( 'after_setup_theme', ... )php
add_action( 'after_setup_theme', 'wpdocs_theme_setup' );
function wpdocs_theme_setup() {
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'html5', array( 'search-form', 'gallery', 'caption' ) );
register_nav_menus( array(
'primary' => __( 'Menu główne', 'wpdocs' ),
'footer' => __( 'Menu w stopce', 'wpdocs' ),
) );
}
add_action( 'after_setup_theme', 'wpdocs_theme_setup' );
function wpdocs_theme_setup() {
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'html5', array( 'search-form', 'gallery', 'caption' ) );
register_nav_menus( array(
'primary' => __( 'Menu główne', 'wpdocs' ),
'footer' => __( 'Menu w stopce', 'wpdocs' ),
) );
}Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej
add_action( 'after_setup_theme', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}
// rejestracja funkcji zwrotnej
add_action( 'after_setup_theme', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}Popularne w tej kategorii