Custom Nav Walker Displaying Values in Sub Menu
I’ve managed to sort this All I needed to do was remove these lines. $output .= “</div>”; $output .= “</dropdown-link>”; $output .= “</div>”;
I’ve managed to sort this All I needed to do was remove these lines. $output .= “</div>”; $output .= “</dropdown-link>”; $output .= “</div>”;
Is this right: First 5 pages – Administrators ONLY, NO subscribers Sixth page – Subscriber ONLY, NO Administrator ? If this is correct than you only have to add the capability type as ‘administrator’ when creating the first 5, and ‘subscriber’ for creating the sixth. That should work. Or add a new capability for admin, … Read more
Using the plugin “Advanced menu widget” by Ján Bočínec one can get pretty close. With one big exception: when you look at a post from category A, the whole sub-menu vanishes (except for a remaining empty <ul></ul>-construct). So we are still looking for a working solution. We are going to try it now with Gecka … Read more
I’d use the native WordPress custom menus mostly because they allow the admin to edit the content easily. I don’t see the other solutions you propose as flexible enough for a client to use. I don’t think it’s possible to avoid complexity completely in this case. Better to focus on educating the client. By the … Read more
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
Here is a simple example to get you started with the right code. This creates a main menu item using add_menu_page then attaches a submenu using add_submenu_page. Both of them call a different function for the output. Notice that the add_submenu_page function ties into the parent menu using customteam which is the $menu_slug of add_menu_page. … Read more
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
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
The wp_list_pages() function will generate a hierarchical list of pages for you.
Effectively you can do this by adding a sublevel item with the same menu slug as the top level, while changing the submenu item title. This avoids the look of duplicate menu items, even though the destination of the top level, and the first sub menu item are the same. You have to have at … Read more