首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在不同的页面上显示不同的菜单?

如何在不同的页面上显示不同的菜单?
EN

Stack Overflow用户
提问于 2019-04-10 18:20:41
回答 1查看 41关注 0票数 0

我正在使用阿斯塔Wordpress主题和它的4个菜单的单页网站。现在我已经创建了2多个页面,但菜单不工作,因为它只属于主页。有没有办法为不同的页面设置不同的菜单?

EN

回答 1

Stack Overflow用户

发布于 2019-04-10 19:01:22

代码语言:javascript
复制
usually all the pages follow page.php, have a look if you have header imported in page.php, if you want a different header menu, create a different header and rename as header-pages.php, assign a different menu here as 

<?php wp_nav_menu(array(
                    'theme_location' => 'page_menu',
                    'container' => false,
                    'depth'           => 3
                    )) 
                  ?>  

add this to your functions.php by editing the existing array

register_nav_menus( array(
        -------remove this, add the below code only in existing array------
        'page_menu' => esc_html__( 'Page Menu', 'website' )
        -------remove this, add the above code only in existing array------
		
    ));

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55610135

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档