Wordpress Navigation Label in Browser tab

纵饮孤独 提交于 2019-12-25 00:24:35

问题


I am trying to edit my header.php to call the navigation label of a page as opposed to the page title. Here is the existing code...

<title><?php wp_title( '' ); ?></title>

What is the code for calling or echoing the navigation label of a menu item?

Thanks.


回答1:


What you need is to access the wp_nav_menu_objects, by first rendering the menu to extract the label in order to use it on the page title.

You can see a working solution well explained on this links:

How to get current-menu-item title as variable?

first render the menu and then display it later



来源:https://stackoverflow.com/questions/10865920/wordpress-navigation-label-in-browser-tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!