Register Extra Menu Locations
Adds new menu locations, such as a footer menu and a legal links menu, that you can assign under Appearance > Menus and print with wp_nav_menu() in a classic theme.
Opens WPIDE on
Code
add_action( 'after_setup_theme', function () {
register_nav_menus( array(
'wpide-footer' => 'Footer menu',
'wpide-legal' => 'Legal links',
) );
}, 20 );
Notes
Print a location in a template with wp_nav_menu( array( 'theme_location' => 'wpide-footer' ) );. Block themes use the Navigation block instead.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.