Nav walker, bootstrap: Display 3rd level items under 2nd level

I solved this problem. follow these instructions….. Add script (function($){ $(document).ready(function(){ $(‘ul.dropdown-menu [data-toggle=dropdown]’).on(‘click’, function(event) { event.preventDefault(); event.stopPropagation(); $(this).parent().siblings().removeClass(‘open’); $(this).parent().toggleClass(‘open’); }); }); })(jQuery); 2.Remove && $depth === 0 from this line: if ( $args->has_children && $depth === 0 ) in wp_bootstrap_navwalker.php file. See the screenshot here.

Adding different classes to anchor in navigation menu

Yes, it is possible. You can achieve this using wp_nav_menu_objects filter. function my_wp_nav_menu_objects($objects, $args) { foreach($objects as $key => $item) { $objects[$key]->classes[] = ‘my-class’; } return $objects; } add_filter(‘wp_nav_menu_objects’, ‘my_wp_nav_menu_objects’, 10, 2); The only problem is that these classes will be added to li elements and not to links directly. But it’s default WordPress behavior … Read more

Subpages return 404 error [closed]

You’re wanting to use “Pretty Permalinks” and in order to do so you need to have some form of rewrite documentation present. The easiest and most common is a .htaccess file to hold the rewrite rules. Do you have an .htaccess present for the site? If you do not, you can reference the WordPress Codex … Read more

Generate a tabbed submenu — from taxonomy term or submenu item — with sample content

I ended up solving this problem with Ubermenu. What I wanted to write was complex enough that it made more sense to get a tested, commercial plugin that had the features I need. MaxMegaMenu didn’t do tabbed content but Ubermenu does. I’m able to construct menus like this: Taxonomy1 [Tabs] [DynamicTerms] [Dynamic Posts] Taxonomy2 [Tabs] … Read more

Add div to specific sub-menu

The WordPress native Walker class doesn’t pass the arguments you need to the start_lvl() method. So to do this, you will need to add a custom display_element() method to your custom walker. You can use most of the original, with something similar to the commented section below: public function display_element( $element, &$children_elements, $max_depth, $depth, $args, … Read more

Admin Menu – Highlight top-level menu when on a sub-menu page (without showing sub-menu)

That’s a bit of a late answer and I don’t know if @Jay ever sorted it out, but to anyone having the same issue, here’s how I fixed it. Menu Pages function my_admin_menu() { add_menu_page( ‘Page title’, ‘Menu title’, ‘manage_options’, ‘my_page’, null, null, 99 ); add_submenu_page( ‘my_page’, ‘Subpage 1 title’, ‘Subpage 1 menu title’, ‘manage_options’, … Read more

Check if wp_nav_menu items have submenus

If I understand correctly, you want links with submenus to have an attribute of aria-haspopup. If this is correct, you should be able to do so using the nav_menu_link_attributes filter (WP 3.6 and above). You can also get around the necessity of having to write a custom Walker to check if an item has children … Read more

Custom Nav Walker sub-menu HTML construct

Solution: Copy paste the below code into your function. and then in template use my_nav_menu($menu_location); //put this in your functions class MY_Menu_Walker_Ext extends Walker { var $tree_type = array(‘post_type’, ‘taxonomy’, ‘custom’); var $db_fields = array(‘parent’ => ‘menu_item_parent’, ‘id’ => ‘db_id’); function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0) { $output .=”<li><h2 … Read more

How can I add a sub menu to an existing navigation menu in WordPress?

I got the answer, here it is: I want to add submenus ffrom database to the menu named ‘Products’ Create a custom plugin and install it through Admin panel. Inside the functions.php write this code. This is upgrade safe way and will not brake if the theme is updated. add_filter( ‘wp_nav_menu_objects’, ‘ravs_add_menu_parent_class’ ); function ravs_add_menu_parent_class( … Read more