$_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; ob_start(); $item_id = esc_attr( $item->ID ); if ( empty( $item->pixwell_mega_cat ) ) { $pixwell_item_mega_cat = null; } else { $pixwell_item_mega_cat = esc_attr( $item->pixwell_mega_cat[0] ); } if ( empty( $item->pixwell_mega_cat_ajax ) ) { $pixwell_item_mega_cat_ajax = null; } else { $pixwell_item_mega_cat_ajax = esc_attr( $item->pixwell_mega_cat_ajax[0] ); } if ( empty( $item->pixwell_mega_col ) ) { $pixwell_item_mega_col = null; } else { $pixwell_item_mega_col = esc_attr( $item->pixwell_mega_col ); } if ( empty( $item->pixwell_mega_col_bg ) ) { $pixwell_item_mega_col_bg = null; } else { $pixwell_item_mega_col_bg = esc_attr( $item->pixwell_mega_col_bg ); } if ( empty( $item->pixwell_sub_image ) ) { $pixwell_item_mega_sub_image = null; } else { $pixwell_item_mega_sub_image = esc_attr( $item->pixwell_sub_image ); } $removed_args = [ 'action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce', ]; $original_title = ''; if ( 'taxonomy' == $item->type ) { $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' ); if ( is_wp_error( $original_title ) ) { $original_title = false; } } elseif ( 'post_type' == $item->type ) { $original_object = get_post( $item->object_id ); $original_title = $original_object->post_title; } $classes = [ 'menu-item menu-item-depth-' . $depth, 'menu-item-' . esc_attr( $item->object ), 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive' ), ]; $title = $item->title; if ( ! empty( $item->_invalid ) ) { $classes[] = 'menu-item-invalid'; $title = sprintf( esc_html__( '%s (Invalid)', 'pixwell' ), $item->title ); } elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) { $classes[] = 'pending'; $title = sprintf( esc_html__( '%s (Pending)', 'pixwell' ), $item->title ); } $title = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label; $submenu_text = ''; if ( 0 == $depth ) { $submenu_text = 'style="display: none;"'; } ?> '; } /** * @param string $item_output * @param int $depth * @param array $args * start lvl */ function start_lvl( &$output, $depth = 0, $args = [] ) { if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $indent = str_repeat( $t, $depth ); $classes = [ 'sub-menu' ]; $class_names = join( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $output .= "{$n}{$indent}{$n}"; } /** * @param string $item_output * @param int $depth * @param array $args * end lvl */ function end_lvl( &$output, $depth = 0, $args = [] ) { if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $indent = str_repeat( $t, $depth ); $output .= "$indent{$n}"; } } } /** add span tag to item */ if ( ! function_exists( 'pixwell_add_span_sub_menu' ) ) { function pixwell_add_span_sub_menu( $title, $item, $args, $depth ) { return '' . $title . ''; } } /** fallback menu */ if ( ! function_exists( 'pixwell_navigation_fallback' ) ) { function pixwell_navigation_fallback() { if ( ! current_user_can( 'manage_options' ) ) { return false; } ?>