• Resolved kasparvihm

    (@kasparvihm)


    Hi,

    I’m trying to make a custom WP menu based on default walker function (wp-includes/nav-menu-template.php).

    I want to add the custom menu item class ( CSS Classes (optional) ) to <i> element. Right now I can call out all classes including the custom one.

    $item_output = $args->before;
    $item_output .= '<a'. $attributes .'>';
    $item_output .= '<i aria-hidden="true" '. $class_names .'></i>';
    $item_output .= '<span>';
    $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
    $item_output .= '<span>';
    $item_output .= '</a>';
    $item_output .= $args->after;

    Is there a way to get the custom class?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter kasparvihm

    (@kasparvihm)

    Solution found!

    It’s a good idea to share the solution, since other people can find it helpful. In this case, I need exactly what you needed, and can’t find a solution somewhere else, and if you posted the solution, I would be thanksful.

    too bad dude. Kaspar Vihm you should share your solution with all of us!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to get the custom menu item css class with wp nav menu walker’ is closed to new replies.