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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.