Jump to content

Recommended Posts

Hi all,

 

I am trying to add a series of custom menus to my Wordpress theme but they all return the same menu.

 

I have this in my functions.php

 

add_action('init', 'register_custom_menu');

function register_custom_menu() {

register_nav_menu('custom_menu', __('Custom Menu'));

register_nav_menu('specials_menu', __('Specials Menu'));

}

 

and this in the nav section of my header:

 

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

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

 

Can anyone tell me where I've gone wrong? I thought this was the way it was meant to work

 

Link to comment
https://forums.phpfreaks.com/topic/254523-wordpress-custom-menus-help/
Share on other sites

OK I think I have found the solution:

 

Replace the word 'menu' in <?php wp_nav_menu(array('menu' => 'specials_menu')); ?>

 

to 'theme_location' e.g:

 

<?php wp_nav_menu(array('theme_location' => 'specials_menu')); ?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.