Hi guys,
Is it possible to show the title of a custom menu on the front-end?
I now have this code which only shows the items:
<?php wp_nav_menu( array( 'theme_location' => 'header' ) ); ?>
How to also display the title of the menu?
Thanks!
Hi guys,
Is it possible to show the title of a custom menu on the front-end?
I now have this code which only shows the items:
<?php wp_nav_menu( array( 'theme_location' => 'header' ) ); ?>
How to also display the title of the menu?
Thanks!
Try it whith this:
<?php
$menu_location = 'header';
$menu_locations = get_nav_menu_locations();
$menu_object = (isset($menu_locations[$menu_location]) ? wp_get_nav_menu_object($menu_locations[$menu_location]) : null);
$menu_name = (isset($menu_object->name) ? $menu_object->name : '');
echo esc_html($menu_name);
?>Thank you, that worked.
So your code should be added to mine right? It is not possible to use the wp_nav_menu array for the Title and the Items?
Thanks a lot!
It is not possible to use the wp_nav_menu array for the Title and the Items?
Do you want the title inside the menu? Not sure what you want.
maybe this: http://codex.wordpress.org/Function_Reference/wp_nav_menu#Adding_a_Word_at_the_Beginning_of_the_Menu
Yeah found that already. Anyway i got it. So many thanks (Y)
You're welcome. Glad you got it resolved
This topic has been closed to new replies.