Custom menu walker – remove li tag based on class name

Do you have error logging on? If you’re running the latest version of WP, this should be throwing an error because start_el and end_el are public functions.

Also, if you’re using a custom walker, you should only use the walker and not your additional theme_function.

class wpseWalker extends Walker_Nav_Menu {
    public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
        $classes = empty( $item->classes ) ? array() : (array) $item->classes;
        $classes[] = 'menu-item-' . $item->ID;
        if(in_array('custom-theme-class', $classes) {
            $output .= '<div class="navbar-item">' . $value;
        } else {
            $output .= $indent . '<li' . $id . $value . $class_names . $data_dropdown . '>';
        }
    }
    public function end_el( &$output, $item, $depth = 0, $args = array() ) {
        $classes = empty( $item->classes ) ? array() : (array) $item->classes;
        $classes[] = 'menu-item-' . $item->ID;
        if(in_array('custom-theme-class', $classes) {
            $output .= "</div>\n";
        } else {
            $output .= "</li>\n";
        }
    }
}