further fix menu generation, add missing images
This commit is contained in:
parent
1a3af93a01
commit
a945c96842
6 changed files with 51 additions and 39 deletions
|
|
@ -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>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue