Tag Info

Hot answers tagged

2

You can do this easy way or hard way. Hard way would be you creating custom functions to remove all menu classes and add FontAwesome icons accordingly. And easy way would be this. Go to Appearance > Menus And add FontAwesome icons in menu items. Like this. Note: You don't need to change page titles on each page. Just menu labels.


2

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); ...


1

try and add your location as a parameter. <?php if ( has_nav_menu( $location ) ) { //Do something } ?>


1

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 '; }


1

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', ...


1

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