Tag Info

Hot answers tagged


Per comments, it's called with call_user_func_array, so the 1st 2 elements get assigned to the declared arguments $elements and $max_depth, leaving the third element ($r which is the original $args) to be assigned via array_slice to $args. Eg function wpse172812( $elements, $max_depth ) { $args = array_slice(func_get_args(), 2); ...


I figured out a way. I changed the if statement to if (in_array('current-menu-item', $classes) || in_array('current-page-ancestor', $classes)) { $classes[] = 'active '; }


I searched and read about the walker class. I ran tests, I played around the code and I finally did get to understand it. I hope this can be helpfull to others too. You'll need to implement the walker class for this. Here is a simple example. $defaults = array( 'theme_location' => 'primary', 'container' => 'ul', ...


I think it would be useful to create a custom walker for your menu. In the following code example I made use of the Menu Item Object. You can take a look at the object output here. An object type is specified for every menu item. So I just compare if the object is a category. If yes I made use of the specified object ID to get the category + category ...

Only top voted, non community-wiki answers of a minimum length are eligible