Site icon Hip-Hop Website Design and Development

wordpress walker add class to submenu a href

I’m having some troubles with my wordpress walker code. I do know it is potential so as to add a customized css class manually by way of the admin menu part. However what i’m attempting to attain is to get this achieved mechanically every time a submenu web page is added by my shopper.

Step one i took was to switch the ul li navigation and alter it to an a href navigational fashion. This works. Now i’m in search of a means so as to add a category to the submenu a href gadgets…

That is how my walker seems to be like in the intervening time.



class Description_Walker extends Walker_Nav_Menu { perform start_el(&$output, $merchandise, $depth, $args) { $lessons = empty($item->lessons) ? array () : (array) $item->lessons; $class_names = be part of(' ', apply_filters( 'nav_menu_css_class', array_filter( $lessons ), $merchandise ) ); !empty ( $class_names ) and $class_names = ' class="'. esc_attr( $class_names ) . '"'; $output .= ""; $attributes = ''; !empty( $item->attr_title ) and $attributes .= ' title="' . esc_attr( $item->attr_title ) .'"'; !empty( $item->goal ) and $attributes .= ' goal="' . esc_attr( $item->goal ) .'"'; !empty( $item->xfn ) and $attributes .= ' rel="' . esc_attr( $item->xfn ) .'"'; !empty( $item->url ) and $attributes .= ' href="' . esc_attr( $item->url ) .'"'; $title = apply_filters( 'the_title', $item->title, $item->ID ); $item_output = $args->earlier than . "" . $args->link_before . $title . '' . $args->link_after . $args->after;

            if (array_search('menu-item-has-children', $item->lessons))  else {

    $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $merchandise, $depth, $args );
        }
}

    perform start_lvl(&$output, $depth, $args ) {
            $indent = str_repeat("t", $depth);
            $output .= "n$indent<nav class="dropdown-list">n<div class="submenu_speech"></div>";
    }

    perform end_lvl( &$output, $depth, $args = array() ) {
            $indent = str_repeat("t", $depth);
            $output .= "$indent</nav></div>n";
    }

    perform end_el(&$output, $merchandise, $depth, $args) {
            $output .= "n";
    }

}