You need to move closing tags of the parent element to
end_el()
method override.
E.g. in your case:
function start_el(&$output, $item, $depth, $args) {
global $wp_query;
/*
* Генерируем строку с CSS-классами элемента меню
*/
if($depth == 0){
$class_names = 'header_nav-link_wrap';
}else{
$class_names = '';
}
!empty ( $class_names ) and $class_names = ' class="'. esc_attr( $class_names ) . '"';
if($depth == 0){
$output .= "<div $class_names>";
}else{
$output .= "";
}
$attributes = '';
if($depth == 0){
$attributes .= 'class="header_nav-link"';
}else{
$attributes .= 'class="header_nav-sublink"';
}
!empty( $item->url ) and $attributes .= ' href="' . esc_attr( $item->url ) .'"';
$title = apply_filters( 'the_title', $item->title, $item->ID );
$item_output = $args->before
. "<a $attributes>"
. $args->link_before
. $title
. '</a>'
. $args->link_after
. $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
function end_el(&$output, $item, $depth, $args) {
if($depth == 0){
$output .= "</div>";
}
}