New answers tagged

0

Alright so this isn't too difficult, first we will just check if the menu item is a taxonomy then get the count and display it! function ggstyle_menu_item_count( $output, $item, $depth, $args ) { // Check if the item is a Category or Custom Taxonomy if( $item->type == 'taxonomy' ) { $object = get_term($item->object_id, $item->...


0

Yes it is possible, please take a look at the code below it will give you the basic idea. You can change ul to div and add some logic to match your needs. $menu_name = 'primary'; $menu = wp_get_nav_menu_object( $locations[ $menu_name ] ); $menu_items = wp_get_nav_menu_items($menu->term_id); $menu_list = '<ul id="menu-' . $menu_name . '">'; foreach (...


1

If you will not pass that how many arguments you need in your callback function then add_filter will provide you only one and first argument. Because default arguments for add_filter are add_filter ( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 ); $accepted_args is 1 if you do not pass it. Thus $args is always ...


2

You certainly could build a custom walker, but perhaps the easiest way out is jquery: $("li.active").parent().addClass("is-active");


0

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] ...


4

Assuming you're using wp_nav_menu() to display your navigation you could apply a walker that looks for css classes: $items_wrap = '<nav class="...">'; $items_wrap .= '<ul id="%1$s" class="%2$s">%3$s</ul>'; $items_wrap .= '</nav>'; wp_nav_menu( array( 'container' => false, 'container_class' => false, '...



Top 50 recent answers are included