'; if ( ! empty( $settings[ $item->ID ]['icon'] ) ) { $output .= ''; } elseif ( ! empty( $settings[ $item->ID ]['icon_image'] ) ) { if ( ! empty( $settings[ $item->ID ]['dark_icon_image'] ) ) { $output .= '
'; } else { $output .= ''; } } $output .= $title; if ( ! empty( $settings[ $item->ID ]['sub_label'] ) ) { $output .= ' '; } $output .= ''; return $output; } } if ( ! class_exists( 'Foxiz_Walker_Nav_Menu', false ) ) { /** * Class Foxiz_Walker_Nav_Menu */ class Foxiz_Walker_Nav_Menu extends Walker_Nav_Menu { static function get_menu_id( $args ) { if ( ! empty( $args->menu->term_id ) ) { return intval( $args->menu->term_id ); } elseif ( ! empty( $args->menu ) ) { $menu = wp_get_nav_menu_object( $args->menu ); return $menu->term_id; } return false; } public function start_el( &$output, $item, $depth = 0, $args = null, $id = 0 ) { $rb_settings = get_option( 'rb_menu_settings_' . self::get_menu_id( $args ), array() ); if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $indent = ( $depth ) ? str_repeat( $t, $depth ) : ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; if ( empty( $depth ) && 'category' === $item->object && ! empty( $rb_settings[ $item->ID ]['category'] ) ) { $classes[] = 'menu-item-has-children menu-has-child-mega is-child-wide'; if ( ! empty ( $rb_settings[ $item->ID ]['layout'] ) ) { $classes[] = 'mega-hierarchical'; } } elseif ( empty( $depth ) && ( 'custom' === $item->object ) && ! empty ( $rb_settings[ $item->ID ]['mega_shortcode'] ) ) { $classes[] = 'menu-item-has-children menu-has-child-mega menu-has-child-mega-template'; if ( empty( $rb_settings[ $item->ID ]['mega_width'] ) ) { $classes[] = 'is-child-wide'; } } elseif ( empty( $depth ) && ( 'custom' === $item->object ) && ( ! empty ( $rb_settings[ $item->ID ]['columns'] ) ) ) { $classes[] = 'menu-item-has-children menu-has-child-mega menu-has-child-mega-columns'; if ( empty( $rb_settings[ $item->ID ]['mega_width'] ) ) { $classes[] = 'is-child-wide'; } if ( ! empty( $rb_settings[ $item->ID ]['mega_shortcode'] ) ) { $rb_settings[ $item->ID ]['columns_per_row'] = 1; } if ( ! empty ( $rb_settings[ $item->ID ]['columns_per_row'] ) ) { $classes[] = 'layout-col-' . $rb_settings[ $item->ID ]['columns_per_row']; } } $args = apply_filters( 'nav_menu_item_args', $args, $item, $depth ); $class_names = implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth ); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; $output .= $indent . '