0

I went into Appearances > Menus and created my own menu called "default menu." Then I tried to include it in my WordPress theme, but was unsuccessful. I am trying to include it just before the footer.

When I tried with this code:

<?php wp_nav_menu('theme_location=header-menu&container=false&menu_id='); ?>

it just gave me a list of all the pages I've created.

So then I tried with:

<?php echo do_shortcode('[listmenu menu="default menu"]'); ?>

and then it just echoed what was in the PHP tag.

Please tell me what I should be doing differently. Thank you.

1 Answer 1

0

wp_nav_menu() is the correct function to display a menu.

Is the default menu assigned to the location you've specified and if so, are there any items assigned to that menu?

Menus without any items assign will display pages by default. You could try adding the menu param with a value of the name of your default menu.

1
  • Yes, I changed the menu name to "default-menu" then tried <?php wp_nav_menu('theme_location=header-menu&container=false&menu=default-menu'); ?> and it worked, thank you! Apr 29, 2019 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.