Menu management has always been considered a highlight of WordPress, allowing you to control navigation menus flexibly. Through the convenient drag-and-drop interface, free from the limitations of the theme itself, create various combinations of links: internal links, external links, classification, etc., and can embed these custom menus into any location of the theme, feel that WordPress is getting closer and closer to the CMS program.
Of course, all these functions need thematic support. Earlier, I wrote an article on how to support WordPress custom menus. Today I'll teach you how to add more than one custom menu. Take two examples.
'header-menu' => __( 'mainmenu' ),
'footer-menu' => __( 'footmenu' )
the header-menu and footer-menu are used after the name of the menu (can be arbitrary), the Chinese part will be displayed in the background menu settings page.
2. Add the calling code to the location where you are going to display it.
Usually in header, open header.php and find something similar:
<?php wp_list_pages('depth=2&title_li='); ?>
<?php wp_list_categories('title_li=&orderby=id'); ?>
<?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>
<?php wp_nav_menu( array( 'theme_location' => 'footer-menu' ) ); ?>
The header-menu and footer-menu are the name of the menu to be invoked, the same as in the first step.
The above two functions can be put in other places, such as sidebar or footer, to see what you like.
3. Define CSS styles appropriately according to different locations.