How to prevent Widget from echoing to wrong position in DOM
dynamic_sidebar will output the sidebar when it is called. Try using it with buffering and store into a variable as below: <ul class=”menu”> <?php $locations = get_nav_menu_locations(); if ( isset( $locations[ ‘mega_menu’ ] ) ) { $menu = get_term( $locations[ ‘mega_menu’ ], ‘nav_menu’ ); if ( $items = wp_get_nav_menu_items( $menu->name ) ) { foreach ( … Read more