没有链接的Wordpress列表菜单项(作为没有链接的纯文本) [英] Wordpress List Menu Items without Links (as plain text without links)
问题描述
我正在寻找一个选项,以列出没有链接的特定菜单中的所有菜单项.我碰到wp_get_nav_menu_items(),但似乎无法找到菜单项
I am looking for an option to list all menu items in a particular menu without the links. I came across wp_get_nav_menu_items(), but cant seem to be able to find the menu slug
http://codex.wordpress.org/Function_Reference/wp_get_nav_menu_items
如果有人可以通过菜单名称/菜单ID帮助我做到这一点,我将不胜感激
If somebody can help me do this with menu name/menu id, I would be most grateful
推荐答案
您可以在header.php或functions.php文件中找到菜单项"(菜单名称).
You can find the "menu slug"(menu name) on header.php or functions.php file.
方法1 : 查看 header.php 文件
Method 1: Look into header.php file
打开主题文件夹,然后找到header.php文件.在该文件中,将有类似以下内容的行:
open your theme folder and find header.php file. In that file there will be a line similar to this:
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
这里primary
是您的菜单名称.
方法2: 查看 functions.php 文件.
如果您定义了多个菜单,则应在functions.php文件中进行检查.
If you defined multiple menus, then you should check inside the functions.php file.
在该文件中,您可能会找到类似于以下内容的行:
In that file you may find a line similar to this:
register_nav_menu( 'primary', __( 'Primary Menu', 'twentyeleven' ) );
这里primary
是您的菜单名称.
希望这会对您有所帮助.
Hope this will help you.
这篇关于没有链接的Wordpress列表菜单项(作为没有链接的纯文本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!