简体   繁体   English

辅助主题上的WordPress自定义导航

[英]Wordpress Custom Navigation on Secondary Theme

I've followed the codex; 我遵循了食典。 http://codex.wordpress.org/Navigation_Menus However I believe that because we are trying to do the edits on page that isn't using the main sites theme, it's falling apart. http://codex.wordpress.org/Navigation_Menus但是,我相信因为我们试图在不使用主要网站主题的页面上进行编辑,所以它正在瓦解。

Our standard theme is Grand College, the theme however we are trying to edit is a BlankSlate theme. 我们的标准主题是大学院,但是我们尝试编辑的主题是BlankSlate主题。

I've made the edits in the BlankSlate functions file and inserted: 我在BlankSlate函数文件中进行了编辑并插入:

function register_my_menu() {
register_nav_menu('example-menu',__( 'EXAMPLE Menu' ));
}
add_action( 'init', 'register_my_menu' );

In the header file I've inserted; 在我插入的头文件中;

<?php wp_nav_menu( array( 'theme_location' => 'example-menu' ) ); ?>

And in the WP-admin dashboard I've built a menu for 'example': I've added Home and Contact to it. 并且在WP-admin仪表板中,我为“示例”构建了一个菜单:我向其中添加了“家”和“联系人”。 However in the 'Manage Location' section I've only got 2 menu options which is what Grand College gives you by default 但是在“管理位置”部分,我只有2个菜单选项,这是Grand College默认为您提供的菜单选项

However when I view the site, I get the 'main' navigation showing rather than just the example menu. 但是,当我查看站点时,会显示“主”导航,而不仅仅是示例菜单。

Do my edits to put a new custom menu in, have to be done on the Grand College theme (The sites standard theme, or am I right to be trying to edit the pages theme? 我是否要进行编辑以放入新的自定义菜单,是否必须在Grand College主题(网站标准主题)上进行编辑?还是我想尝试编辑页面主题?

Any help would be great appreciated. 任何帮助将不胜感激。

要注册导航菜单,我只使用了以下代码:

register_nav_menu('example-menu',__( 'EXAMPLE Menu' ));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM