/
home
/
rekodeb
/
webrodez
/
wp-content
/
themes
/
calmer
/
inc
/
classes
/
Upload File
HOME
<?php class calmor_Navwalker extends Walker_Nav_Menu { public function start_lvl( &$output, $depth = 0, $args = []) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<ul class=\"dropdown-menu sub-menu submenu\">\n"; } public function start_el(&$output, $page, $depth = 0, $args = [], $current_page = 0) { $indent = ($depth) ? str_repeat("\t", $depth) : ''; $mega_menu = ''; $mega_menu_width = ''; if(class_exists('ACF')) { $mega_menu = get_field( 'mega_menu_select', $page->ID, true); $mega_menu_width = get_field( 'mega_menu_width', $page->ID, true); } $li_attributes = ''; $class_names = $value = ''; $classes = empty($page->classes) ? array() : (array) $page->classes ; $classes[] = 'nav-item' ; $classes[] = ($mega_menu != '') ? 'has-mega-menu': '' ; $classes[] = ($mega_menu != '' && $mega_menu_width != '') ? $mega_menu_width: '' ; $classes[] = ($args->walker->has_children) ? 'dropdown sub-menu submenu' : ''; $classes[] = ($page->current || $page->current_item_ancestor) ? 'active current-menu-item current_item_ancestor' : ''; $classes[] = 'menu-item-'.$page->ID; if($depth && $args->walker->has_children) { $classes[] = 'dropdown dropdown-submenu'; } $class_names = join(' ', apply_filters( 'nav_menu_css_class', array_filter($classes), $page, $args)); $class_names = ' class="'.esc_attr($class_names).'"'; $id = apply_filters( 'nav_menu_item_id', 'menu-item'.$page->ID, $page, $args ); $id = strlen($id) ? ' id="'.esc_attr($id).'"' : ''; $output .= $indent. '<li '.$class_names. $id . $value. $li_attributes.'>'; $attributes = ! empty( $page->attr_title ) ? ' title="' . esc_attr($page->attr_title) . '"' : ''; $attributes .= ! empty( $page->target ) ? ' target="' . esc_attr($page->target) . '"' : ''; $attributes .= ! empty( $page->xfn ) ? ' rel="' . esc_attr($page->xfn) . '"' : ''; $attributes .= ! empty( $page->url ) ? ' href="' . esc_attr($page->url) . '"' : ''; $attributes .= ( $args->walker->has_children ) ? ' data-toggle="dropdown"' : ''; $href_class[] = 'nav-link'; $href_class[] = ( $args->walker->has_children ) ? 'dropdown-toggle' : ''; $href_class_attr = join(' ', $href_class); $attributes .= ' class="'.esc_attr( $href_class_attr ).'"'; $has_child_icon = ''; if($depth == 0 && $args->walker->has_children) { $has_child_icon = '<i class="fa-solid fa-angle-down mobile_dropdown_icon"></i>'; }elseif ($depth > 0 && $args->walker->has_children) { $has_child_icon = '<i class="fa-solid fa-angle-down mobile_dropdown_icon"></i>'; } $item_output = $args->before; $item_output .= '<a' . $attributes . '>'; $item_output .= $args->link_before . apply_filters( 'the_title', $page->title, $page->ID ) . $args->link_after; $item_output .='</a>'.$has_child_icon; $item_output .= $args->after; $output .= apply_filters ( 'walker_nav_menu_start_el', $item_output, $page, $depth, $args ); } }