I’m trying to add unique content to the end of each dropdown (sub-menu). I’ve managed to edit the end_lvl function of the walker class to add the div to the end of each sub-menu, but now I’m lost on the next step: creating a conditional statement based on the parent-menu-id to echo different content. Any thoughts/suggestions? This is what I have (and I know its obviously not working because I’m trying to use the item array but with menu-parent-id). Clearly I don’t quite understand this.
function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("t", $depth);
$output .= "n$indent<div class="sub-menu">n<ul>";
}
function end_lvl( &$output, $depth = 0, $item, $args = array() ) {
$indent = str_repeat("t", $depth);
if($item->menu-item-parent==37) {
$afterMenuContent = "Content";
}
$output .= "$indent</ul>n<div class="after-menu">" . $afterMenuContent . "</div>n</div>";
}
Use
instead of
Can you show us the html output you want ?