Adding secondary menus to WordPress

Usually websites are having the main navigation menu, but sometimes additional menus are required.

It is possible to have special context menus depending on the selected item in the WordPress main menu.

In WordPress adding additional menus goes like this:

1. Login to your backend and add a menu

Let’s name it “topmenu”.

2. Add the following line inside your WordPress theme:

<?php wp_nav_menu( array('menu' => 'topmenu' )); ?>

I added the code to the header.php, but this will work also from any theme file: footer.php, sidebar.php, category.php, home.php, page-default.php, …

3. Test the result from the front-end.

tags: & category: -