如何获得菜单中应有的导航标签
我正在使用这个代码
<?php
$locations = get_registered_nav_menus();
$menus = wp_get_nav_menus();
$menu_locations = get_nav_menu_locations();
$location_id = \'footer_menu1\';
if (isset($menu_locations[ $location_id ]))
{
foreach ($menus as $menu)
{
if ($menu->term_id == $menu_locations[ $location_id ])
{
echo \'<h2>\'.$menu->name.\'</h2>\';
// Get the items for this menu
$menu_items = wp_get_nav_menu_items($menu);
foreach ( $menu_items as $item )
{
$id = get_post_meta( $item->ID, \'_menu_item_object_id\', true );
$page = get_page( $id );
//$link = get_page_link( $id ); ?>
<li><a href="<?php echo $item->url; ?>" > <?php echo $page->post_title; ?> </a></li>
<?php
}
break;
}
}
}
?>
提前感谢!
我可以替换吗<?php echo $page->post_title; ?>
具有<?php echo $menu->nav_label; ?>