further fix menu generation, add missing images

This commit is contained in:
Jonas Heinrich 2020-04-10 12:02:24 +02:00
parent 1a3af93a01
commit a945c96842
6 changed files with 51 additions and 39 deletions

View file

@ -186,6 +186,9 @@ header:not(.sticky-header) .header-button-container {
}
@media (max-width: 960px) {
body.logged-in header {
top: 45px;
}
header {
position: fixed;
top: 0;

View file

@ -273,7 +273,7 @@ nav > ul > li .nav-first-level-opener::after {
width: 0.88889rem;
height: 0.88889rem;
font-size: 1.44444rem;
background-image: url(img/arrow-right-grey.svg);
background-image: url(../img/arrow-right-grey.svg);
background-repeat: no-repeat;
background-position: center;
background-size: contain;

View file

@ -14,26 +14,10 @@ function kit_setup() {
add_action( 'after_setup_theme', 'kit_setup' );
// <ul id="menu-hauptmenue" class="">
// <li id="menu-item-45" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-45 dropdown"><a title="Über uns" href="#" data-toggle="dropdown" class="dropdown-toggle">Über uns <i class="fa fa-angle-down"></i></a>
// <ul role="menu" class=" dropdown-menu">
// <li id="menu-item-46" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-46"><a title="MitarbeiterInnen" href="http://localhost:8080/mitarbeiterinnen/">MitarbeiterInnen</a></li>
// </ul>
// </li>
// </ul>
// <ul id="menu-hauptmenue" class="">
// <li class=' menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children'>
// <a href="http://localhost:8080/ueber-uns/">Über uns</a>
// <ul class="sub-menu">
// <li class=' menu-item menu-item-type-post_type menu-item-object-page'><a href="http://localhost:8080/mitarbeiterinnen/">MitarbeiterInnen</a></li>
// </ul>
// </li>
// </ul>
class kit_custom_main_menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth = 0, $args = array() ) {
// depth dependent classes
$indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent
$display_depth = ( $depth + 1); // because it counts the first submenu as 0
@ -45,9 +29,15 @@ class kit_custom_main_menu extends Walker_Nav_Menu {
// build html
if ($display_depth == 1) {
$output .= "\n" . $indent . '<section class="nav-second-level mega-flyout" style=""><div class="content-wrap"><ul class="' . $class_names . '">' . "\n";
$output .= "\n" . $indent . '
<section class="nav-second-level mega-flyout" style="">
<div class="content-wrap">
<div class="container container-3-cols">
<div class="column">
<div class="nav-second-level-group">
' . "\n";
} else {
$output .= "\n" . $indent . '<ul class="' . $class_names . '">' . "\n";
$output .= "\n" . $indent . '<ul>' . "\n";
}
}
@ -63,7 +53,12 @@ class kit_custom_main_menu extends Walker_Nav_Menu {
// build html
if ($display_depth == 1) {
$output .= "\n" . $indent . '</ul></div></section>' . "\n";
$output .= "\n" . $indent . '
</div>
</div>
</div>
</div>
</section>' . "\n";
} else {
$output .= "\n" . $indent . '</ul>' . "\n";
}
@ -76,25 +71,36 @@ class kit_custom_main_menu extends Walker_Nav_Menu {
$description = $item->description;
$permalink = $item->url;
$output .= "<li class='" . implode(" ", $item->classes) . "'>";
$theme_template_path = get_template_directory_uri();
//Add SPAN if no Permalink
if( $permalink && $permalink != '#' ) {
$output .= '<a href="' . $permalink . '">';
if ($depth == 1) {
$output .= '
<a class="nav-second-level-group-headline" href="' . $permalink . '">
<img class="icon" src="' . $theme_template_path .'/img/nav-second-level-star-primary.svg" alt="" width="24" height="24">
<span>
';
$output .= $title;
$output .= '
</span>
</a>';
} else {
$output .= '<span>';
}
$output .= $title;
if( $description != '' && $depth == 0 ) {
$output .= '<small class="description">' . $description . '</small>';
}
if( $permalink && $permalink != '#' ) {
$output .= "<li class='" . implode(" ", $item->classes) . "'>";
$output .= '<a href="' . $permalink . '">';
$output .= $title;
$output .= '</a>';
}
}
function end_el(&$output, $item, $depth = 0, $args=array(), $id = 0) {
$object = $item->object;
$type = $item->type;
$title = $item->title;
$description = $item->description;
$permalink = $item->url;
if ($depth == 1) {
} else {
$output .= '</span>';
$output .= '</li>';
}
}

1
kit/img/burger-menu.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 42 42"><title>burger-menu</title><rect width="42" height="42" rx="3.1" style="fill:#1d1d1b"/><line x1="10.6" y1="13.78" x2="31.4" y2="13.78" style="fill:none;stroke:#fff;stroke-linecap:round;stroke-miterlimit:10;stroke-width:2px"/><line x1="10.6" y1="21" x2="31.4" y2="21" style="fill:none;stroke:#fff;stroke-linecap:round;stroke-miterlimit:10;stroke-width:2px"/><line x1="10.6" y1="28.22" x2="31.4" y2="28.22" style="fill:none;stroke:#fff;stroke-linecap:round;stroke-miterlimit:10;stroke-width:2px"/></svg>

After

Width:  |  Height:  |  Size: 560 B

View file

@ -23,9 +23,6 @@
<div class="content-wrap">
<div class="container container-3-cols">
<div class="column">
<div class="nav-second-level-group">
<a class="nav-second-level-group-headline" href="https://www.kit-ausbildung.de/de/ueber-das-kit/success-stories">