fix do not show collapse menu in mobile view if there's no sub menu available
This commit is contained in:
parent
ceb00d9599
commit
d2404e6b14
1 changed files with 52 additions and 51 deletions
|
|
@ -31,6 +31,7 @@ add_filter( 'nav_menu_link_attributes', 'add_menu_link_class', 1, 3 );
|
||||||
|
|
||||||
class kit_custom_main_menu extends Walker_Nav_Menu {
|
class kit_custom_main_menu extends Walker_Nav_Menu {
|
||||||
|
|
||||||
|
# Menu start, equivalent to <ul>
|
||||||
function start_lvl( &$output, $depth = 0, $args = array() ) {
|
function start_lvl( &$output, $depth = 0, $args = array() ) {
|
||||||
|
|
||||||
// depth dependent classes
|
// depth dependent classes
|
||||||
|
|
@ -45,6 +46,9 @@ class kit_custom_main_menu extends Walker_Nav_Menu {
|
||||||
// build html
|
// build html
|
||||||
if ($display_depth == 1) {
|
if ($display_depth == 1) {
|
||||||
$output .= "\n" . $indent . '
|
$output .= "\n" . $indent . '
|
||||||
|
<div class="nav-first-level-opener">
|
||||||
|
<span>Untermenu öffnen / schließen</span>
|
||||||
|
</div>
|
||||||
<section class="nav-second-level mega-flyout">
|
<section class="nav-second-level mega-flyout">
|
||||||
<div class="content-wrap">
|
<div class="content-wrap">
|
||||||
<div class="container container-3-cols">
|
<div class="container container-3-cols">
|
||||||
|
|
@ -75,63 +79,60 @@ class kit_custom_main_menu extends Walker_Nav_Menu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_el(&$output, $item, $depth = 0, $args=array(), $id = 0) {
|
# Menu element, equivalent to <li>
|
||||||
$object = $item->object;
|
function start_el(&$output, $item, $depth = 0, $args=array(), $id = 0) {
|
||||||
$type = $item->type;
|
$object = $item->object;
|
||||||
$title = $item->title;
|
$type = $item->type;
|
||||||
$description = $item->description;
|
$title = $item->title;
|
||||||
$permalink = $item->url;
|
$description = $item->description;
|
||||||
|
$permalink = $item->url;
|
||||||
|
|
||||||
$theme_template_path = get_template_directory_uri();
|
$theme_template_path = get_template_directory_uri();
|
||||||
|
|
||||||
if ($depth == 1) {
|
if ($depth == 1) {
|
||||||
$output .= '
|
$output .= '
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="nav-second-level-group">
|
<div class="nav-second-level-group">
|
||||||
<a class="nav-second-level-group-headline" href="' . $permalink . '">
|
<a class="nav-second-level-group-headline" href="' . $permalink . '">
|
||||||
<div class="icon"></div>
|
<div class="icon"></div>
|
||||||
<span>
|
<span>
|
||||||
';
|
';
|
||||||
$output .= $title;
|
$output .= $title;
|
||||||
$output .= '
|
$output .= '
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
<div class="nav-second-level-opener">
|
<div class="nav-second-level-opener">
|
||||||
<span>Untermenu öffnen / schließen</span>
|
<span>Untermenu öffnen / schließen</span>
|
||||||
</div>';
|
</div>';
|
||||||
} elseif ($depth == 2) {
|
} elseif ($depth == 2) {
|
||||||
$output .= "<li class='" . implode(" ", $item->classes) . "'>";
|
$output .= "<li class='" . implode(" ", $item->classes) . "'>";
|
||||||
$output .= '
|
$output .= '
|
||||||
<a href="' . $permalink . '">';
|
<a href="' . $permalink . '">';
|
||||||
$output .= $title;
|
$output .= $title;
|
||||||
$output .= ' </a>';
|
$output .= ' </a>';
|
||||||
} else {
|
} else {
|
||||||
$output .= "<li class='" . implode(" ", $item->classes) . "'>";
|
$output .= "<li class='" . implode(" ", $item->classes) . "'>";
|
||||||
$output .= '<div class="nav-first-level-opener">
|
$output .= '<a href="' . $permalink . '">';
|
||||||
<span>Untermenu öffnen / schließen</span>
|
$output .= $title;
|
||||||
</div>
|
$output .= '</a>';
|
||||||
';
|
|
||||||
$output .= '<a href="' . $permalink . '">';
|
|
||||||
$output .= $title;
|
|
||||||
$output .= '</a>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function end_el(&$output, $item, $depth = 0, $args=array(), $id = 0) {
|
function end_el(&$output, $item, $depth = 0, $args=array(), $id = 0) {
|
||||||
$object = $item->object;
|
$object = $item->object;
|
||||||
$type = $item->type;
|
$type = $item->type;
|
||||||
$title = $item->title;
|
$title = $item->title;
|
||||||
$description = $item->description;
|
$description = $item->description;
|
||||||
$permalink = $item->url;
|
$permalink = $item->url;
|
||||||
|
|
||||||
if ($depth == 1) {
|
if ($depth == 1) {
|
||||||
$output .= '
|
$output .= '
|
||||||
</div>
|
</div>
|
||||||
</div>';
|
</div>';
|
||||||
} else {
|
} else {
|
||||||
$output .= '</li>';
|
$output .= '</li>';
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue