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.
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.
Share Improve this question asked Apr 29, 2019 at 15:30 argoncobaltargoncobalt 31 bronze badge1 Answer
Reset to default 0wp_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.