I have 2 menus in the Wordpress website that I'm developing (top and bottom). The problem is that the wp_nav_menu function is only working correctly when placed in header.php. I'm registering the menus as follows:
function register_my_menus() {
register_nav_menus(
array(
'header' => __( 'Menu Header' ),
'footer' => __( 'Menu Footer' ),
)
);
}
add_action( 'init', 'register_my_menus' );
and I'm displaying it in the header like this:
wp_nav_menu( array( 'theme_location' => 'header','items_wrap' => '<ul class="menu-dinamico">%3$s</ul>' ) );
and in the footer like this:
wp_nav_menu( array( 'theme_location' => 'footer' ) );
Yes, I have already linked the menus in the wordpress panel. The header works normally, footer prints a div with a class that I can not even understand where it comes from.
If I cut the menu code of footer.php and paste it into header.php it works! Could anyone tell me why this is happening and how to solve it?