简体   繁体   English

如何在 Wordpress 自定义菜单上显示导航 Label 而不是页面标题

[英]How to show a Navigation Label instead of a Page Title on a Wordpress custom menu

I am trying to make a custom menu in Wordpress, I've registered it:我正在尝试在 Wordpress 中制作自定义菜单,我已经注册了它:

function theme_features() {
  register_nav_menu('header_menu', 'Header Menu');
}

add_action('after_setup_theme', 'theme_features');

and I'm showing it in the front-end:我在前端展示它:

<?php wp_nav_menu(array(
                     'theme_location' => 'header_menu',
                     'menu_class' => 'navbar__ul',
                  )); 
?>

Then I'm creating the menu in Wordpress admin panel and all is working, the only problem is that when I create an item as such:然后我在 Wordpress 管理面板中创建菜单并且一切正常,唯一的问题是当我这样创建项目时:

wordpress 仪表板的屏幕截图

on the front-end I am getting the page title and not the navigation label I've set:在前端,我得到的是页面标题,而不是我设置的导航 label:

在此处输入图像描述

I've been searching for hours now, if you have any ideas it would be greatly appreciated!!!我已经搜索了几个小时,如果您有任何想法,将不胜感激!!!

I found the answer, I did not connect the menu with the position in the right tab:我找到了答案,我没有将菜单与右侧选项卡中的 position 连接起来:

在此处输入图像描述

I'll leave this here in case someone has the same problem.我会把这个留在这里,以防有人遇到同样的问题。

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

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