Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'walker_nav_menu_start_el', 'generate_tertiary_nav_dropdown', 10, 4 );
- function generate_tertiary_nav_dropdown( $item_output, $item, $depth, $args )
- {
- // If we're working with the primary or secondary theme locations
- if ( 'tertiary' == $args->theme_location ) {
- // If a dropdown menu is detected
- $dropdown = ( in_array( 'menu-item-has-children', $item->classes ) || in_array( 'page_item_has_children', $item->classes ) ) ? true : false;
- if ( $dropdown ) :
- // Add our arrow icon
- $item_output = str_replace( $args->link_after . '</a>', $args->link_after . '<span role="button" class="dropdown-menu-toggle" aria-expanded="false"></span></a>', $item_output );
- endif;
- }
- // Return the output
- return $item_output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement