disable menu collapse/expand function and make a menu item a static, unclickable text
disable menu collapse/expand function and make a menu item a static, unclickable text
disable menu collapse/expand function and make a menu item a static, unclickable text
https://gist.github.com/3853924 This is a plugin I created and usually use for this type of functionality. The key is the little function down at the bottom of the file that searches for the top-level ancestor. There’s also part of the code that will print out categories instead of pages when you’re on a blog or search … Read more
You just need to improve HTML template. You may use this to get it working. You just need to improve your HTML like this. You may also try multi-level-dropdown-menu.
At first glance, and without testing anything, the code you’ve got should work but I expect that you have a number of spurious </ul> in your markup. You need to do nearly the same thing for the end_lvl method. function end_lvl(&$output, $depth) { if($depth >= 2) { $output .= ”; } else { $output .= … Read more
Solved the above issue by putting “show_in_menu” parameter to false while registering the Custom-Post-Type product.
I am guessing you are gonna use pages or categories in the primary menu. The following code would need to be altered to work for custom taxonomies ( should work fine with custom post types also ). Put the following code in your themes functions.php: function km_dynamic_secondary_menu_reg() { global $km_nav_menus; $theme_location = ‘primary’; // replace … Read more
The WordPress functions changed since the answers here in 2014. As of today (Version 4.6.1) this code will create a main menu named “My Menu” , main item and sub item. To run code just paste and saves in your functions.php file in your child theme. $menu_id = wp_create_nav_menu(‘My Menu’); $parent_item = wp_update_nav_menu_item($menu_id, 0, array( … Read more
Count the level 0 elements in a static variable in the method and add an extra class if you hit the third. Sample code: function start_lvl(&$output, $depth) { static $column = 1; $indent = str_repeat(“\t”, $depth); if ($depth > 0) { $output .= “\n$indent<ul class=”subsubmenu”>\n”; } else { $column += 1; $extra = 3 === … Read more