Programmatically adding menu items function replicates in multiple menus

You can use the second input argument $args to target the specific menu. Here’s an example with some checks that you can adjust to your needs: add_filter( ‘wp_nav_menu_objects’, function( $sorted_menu_items, $args ) { if( ‘primary’ === $args->theme_location // Alternative && ‘some_menu_slug’ === $args->menu->slug // Alternative ) { // Your stuff here … } return $sorted_menu_items; … Read more

Arrow down in menu not displaying

Add below code #site-navigation .menu > ul > li.menu-item-has-children > a::after { content: ‘\f107’; font-family: FontAwesome; font-size: 10px; margin-left: 10px; vertical-align: 1px; } #site-navigation .menu > ul > li > ul > li.menu-item-has-children > a::after { color: rgb(34, 34, 34); content: ‘\f105’; font-family: FontAwesome; font-size: 10px; vertical-align: 1px; float: right; } Add 3rd level navigation. … Read more

Custom Walker for Walker_Nav_Menu

Old question, but you can override the </li> in the Walker’s end_el() function (see wp-includes/class-walker-nav-menu.php); in your case, something like: public function end_el( &$output, $item, $depth = 0, $args = array() ) { if ( isset( $args->item_spacing ) && ‘discard’ === $args->item_spacing ) { $n = ”; } else { $n = “\n”; } if … Read more