I have registered the following menus in my
functions.php
Note that register_nav_menus()
which uses register_nav_menu()
(note the singular “menu”) does not register or create a navigation menu; it only registers navigation menu locations which you can assign one or more (navigation) menus to, and for displaying the menus assigned to a specific location, you can use wp_nav_menu()
just as you’ve already tried.
How do I get menus 01 and 02 to show their own links?
The problem in your wp_nav_menu()
call is because you’re not specifying the proper navigation menu location which is identified by the theme_location
parameter like so:
<?php wp_nav_menu( 'theme_location=footer-01' ); ?>
<?php wp_nav_menu( 'theme_location=footer-02' ); ?>
<?php wp_nav_menu( 'theme_location=footer-04' ); ?>
More details based on the wp_nav_menu()
‘s reference:
Usage
wp_nav_menu( $args );
Given a
theme_location
parameter, the function displays the menu assigned to that location. If no such location exists or no menu is
assigned to it, the parameterfallback_cb
will determine what is
displayed.If not given a
theme_location
parameter, the function displays
the menu matching the ID, slug, or name given by the
menu
parameter; e.g.wp_nav_menu( 'menu=123' )
orwp_nav_menu( [ 'menu' => 'My Menu' ] )
otherwise, the first non-empty menu;
otherwise (or if the menu given by
menu
is empty), output of the function given by thefallback_cb
parameter
(wp_page_menu()
,
by default);otherwise, nothing.
(Note: I slightly modified the above quote.)
So be sure to check the reference/docs and supply the proper function arguments. And remember that the above $args
can be an array like array( 'key' => 'value' )
(or [ 'key' => 'value' ]
) or a query string like key=value&key2=value+2
. Both will work in most cases, but when the value contains a space or the value is complex (e.g. it contains HTML tags), then you should use the array format. 🙂