Función PHP para mostrar el menú NAV con ejemplo
// 1. registering the menus
function register_my_menu() {
register_nav_menu('header-menu',__( 'Header Menu' ));
}
add_action( 'init', 'register_my_menu' );
// adding two menus
function register_my_menus() {
register_nav_menus(
array(
'header-menu' => __( 'Header Menu' ),
'extra-menu' => __( 'Extra Menu' )
)
);
}
add_action( 'init', 'register_my_menus' );
// 2. Displaying the menus in theme
<?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>
// displaying extra menu in certain page with certain class
wp_nav_menu( array( 'theme_location' => 'extra-menu', 'container_class' => 'my_extra_menu_class' ) );
sujal lama