Using Different nav_menu_css_class for different nav_walkers

The third parameter passed into nav_menu_css_classes should give you the information you need to sort out the different menus. Try: function onpage_nav_menu_css_class($classes, $item, $args) { var_dump($args); return $classes; } add_filter(‘nav_menu_css_class’, ‘onpage_nav_menu_css_class’, 1, 3); Note: That will make a mess of your page. It is debugging/development only code. I think that the theme_location should be sufficient … Read more

Where these arguments are defined?

You should look on ow WordPress Plugin Api works. When you add a filter, the function that hook into that filter receive the argument from the function: apply_filters. This function pass at least one argument, but can pass more, and always aspect a value returned. So if you can write add_filter( ‘walker_nav_menu_start_el’, ‘description_in_nav_el’, 10, 4 … Read more

Replace Menu Item with Logged in username

you can do it with jQuery, but you’ll need to find that menu item’s class or ID. Here’s an example: <?php global $display_name; get_currentuserinfo(); ?> <script> jQuery(document).ready(function($) { $(‘.your-class a’).text(‘<?php echo $display_name;?>’); }); </script>

How to output the menue structured for tabbed navigation?

What a pitty that nobody responded. I had a hard way checking the walker class first before I found out that it’ll be much easier with wp_get_nav_menu_items() This is what I came up with. Not perfect but it works (only two levels which is enought for my page). $menu_name=”primary”; if ( ( $locations = get_nav_menu_locations() … Read more

How to accomplish a child page navigation?

I’m outlining a solution for you, it uses get_children to determine if there are any, then conditionally sets up the post id $p_id for the child_of parameter, so that the list of child pages from a certain parent always can be shown, by making use of wp_list_pages(). Code: function wpse125273_child_page_nav() { global $post; $args = … Read more