最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

navigation - Walker_Nav_menu access parent menu name

programmeradmin5浏览0评论

I extended Walker_Nav_Menu with the code below and I would like to replace [TITLE HERE] with the name of the parent menu...

In my menu I only display one depth of the navigation at a time. So I would like to display the name of the submenu's parent. How could I achieve that ?

 function start_lvl( &$output, $depth = 0, $args = array() ) {
    $indent = str_repeat("\t", $depth);
        $output .= "<div data-level='$depth'>";
        $output .= "<h2>**[TITLE HERE]**</h2>";
        $output .= "<a class='close' href='#'>Close</a>";
        $output .= "\n$indent<ul class=\"sub-menu\">\n";
    }

Thanks in advance.

J.

发布评论

评论列表(0)

  1. 暂无评论