创建了自定义菜单,但未显示在管理面板中
-
-
尝试进行非常基本的检查,复制菜单名称,然后在编辑器中尝试找到(通常为Ctrl + F)相同的关键字.如果是这样,请解决冲突.对于函数名称,请尝试使用不同于" register_my_menus"的名称.此外,尝试在您的WP安装中打开调试功能.Try a very basic check, copy the menu name and in your editor try to find (typically Ctrl + F) the same keyword exist somewhere else. If so, dissolve the conflict. For function name try something different than `register_my_menus`. And moreover try debugging turned on into your WP installation.
- 0
- 2013-10-06
- Mayeenul Islam
-
@MayeenulIslam,我更改了所有菜单名称和主题位置.问题是,当我创建一个接一个的菜单时,前一个菜单消失了,因此无法将任何菜单项添加到前一个菜单中.如何摆脱这种情况?@MayeenulIslam, I changed all the menu names and theme locations. The problem is when I create a menu after another one the previous menu disappears so I cannot add any menu item to the previous one. How to get rid of this situation ?
- 0
- 2013-10-06
- Istiaque Ahmed
-
1 个回答
- 投票数
-
- 2013-10-06
我认为您无需再次启动菜单,其中
register_nav_menus()
本身就是发起者.语法:
<?php register_nav_menu('your-menu-handle','Your Menu Label');?>
复制以下代码并将其粘贴到您的
functions.php
没有 任何函数或add_action()
,希望它能起作用:register_nav_menus( 数组( 'front_login_menu'=> __('Front Login Menu位置'), 'top_front_general_menu'=> __('Top Front General Menu'), 'top_general_menu'=> __("顶级常规菜单"), 'top_student_menu'=> __("最佳学生菜单"), 'top_admin_menu'=> __("高级管理菜单"), 'top_trainer_menu'=> __('顶级培训师菜单') ) );
在您想要显示菜单的主题中使用以下代码:
<?php wp_nav_menu( 数组( 'theme_location'=>'front_login_menu',//必要时在此处更改子弹 'fallback_cb'=>'' ) );?>
I don't think you need to initiate the menus again where
register_nav_menus()
itself is an initiator.Syntax:
<?php register_nav_menu( 'your-menu-handle', 'Your Menu Label' ); ?>
Copy the following code and Paste them into your
functions.php
without any function oradd_action()
, I hope it'll work:register_nav_menus( array( 'front_login_menu' => __( 'Front Login Menu location'), 'top_front_general_menu' => __( 'Top Front General Menu'), 'top_general_menu' => __( 'Top General Menu'), 'top_student_menu' => __( 'Top Student Menu'), 'top_admin_menu' => __( 'Top Admin Menu'), 'top_trainer_menu' => __( 'Top Trainer Menu' ) ) );
Use the following code into your theme, where you want to show the menu:
<?php wp_nav_menu ( array ( 'theme_location'=>'front_login_menu', //change the slug here where necessary 'fallback_cb'=>'' ) ); ?>
-
没有解决问题.在线服务器的mysql数据库中有问题.想想它是否与此有关,did not solve the question. The online server has prob in its mysql DB. Thinking whether it is related with that,
- 0
- 2013-10-06
- Istiaque Ahmed
-
菜单代码如何与您的数据库概率连接-我也正在考虑这一点.好的,我用双下划线(`__()`)而不是单下划线(`_()`)进行了较小的编辑.(* [知道原因](http://wordpress.stackexchange.com/questions/116609/what-is-meant-by-page-twentytwelve)*)How the menu codes are connected with your db prob - I'm thinking of that too. Ok, I did a minor edit with a double underscore (`__()`) instead of single underscore (`_()`). (*[know why](http://wordpress.stackexchange.com/questions/116609/what-is-meant-by-page-twentytwelve)*)
- 0
- 2013-10-06
- Mayeenul Islam
-
单击Db表的"浏览"选项卡时,显示错误.此问题已解决,菜单名称也已出现.When the `Browse` tab of the Db table was clicked, it showed error. This problem was solved and the menu names also appeared in place.
- 1
- 2013-10-10
- Istiaque Ahmed
我正在制定自己的主题.在
functions.php
中,我添加了-然后,我在管理面板中创建了自定义菜单.但是突然我发现在
Appearance -> Menus
页面,但是主题位置确实存在.但是这些菜单在我的本地主机中可见.我也应该在在线服务器上创建它们(有些甚至不是全部).如果我想创建那些缺少的菜单之一,则消息显示:
如何使这些菜单名称出现在主题位置的右侧?