'menu_item_parent', 'id' => 'db_id', ); public $max_depth = PHP_INT_MAX; public $sub_menus = array(); public function __construct( $settings, $layout = 'horizontal', $max_depth = PHP_INT_MAX ) { $this->menu_settings = $settings; $this->layout = $layout; $this->max_depth = $max_depth; add_filter( 'wp_nav_menu', array( $this, 'push_submenus' ), 100, 2 ); add_filter( 'wp_page_menu', array( $this, 'push_submenus' ), 100, 2 ); } public function push_submenus( $menu, $args ) { if ( 'vertical' === $this->layout ) { foreach ( array_reverse( $this->sub_menus ) as $sub_menu ) { $menu .= $sub_menu; } } remove_filter( 'wp_nav_menu', array( $this, 'push_submenus' ), 100 ); remove_filter( 'wp_page_menu', array( $this, 'push_submenus' ), 100 ); return $menu; } public function start_lvl( &$output, $depth = 1, $args = null, $element = null ) { if ( 'horizontal' === $this->layout ) { $output .= "\n