admin管理员组文章数量:1431500
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.
本文标签: theme developmentHow can I show a custom WordPress menu anywhere I want on my website
版权声明:本文标题:theme development - How can I show a custom WordPress menu anywhere I want on my website? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745537769a2662350.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论