db_fields['id']; if ( is_object( $args[0] ) ) { $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); } return parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); } /** * Start the element output. * * @see Walker_Nav_Menu::start_el() * * @since 1.0 * * @global int $_nav_menu_placeholder * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param array $args Not used. * @param int $id Not used. */ function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { global $wp_query; $indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent. if ( $args->has_children ) { $css_class[] = 'menu-item-has-children'; $args->after = ''; } // passed classes. $classes = empty( $item->classes ) ? array() : (array) $item->classes; $class_names = esc_attr( implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ) ); // build html. $output .= $indent . '\n"; /** * Add logo in the middle of navigation * * If current menu is a top level menu [and] It is equal to our menu middle point. */ if ( isset( $item->menu_item_parent ) ) { if ( '0' === $item->menu_item_parent ) { $this->top_level_item_count++; $output .= apply_filters( 'ast_nav_menu_el_after_' . $args->menu_id, '', $this->top_level_item_count ); } } } } endif;