// ========================================================================= // Chevron to nav menu has children // ========================================================================= function parent_menu_dropdown( $item_output, $item, $depth, $args ) { if ( is_nav_menu( 'Header Menu' ) && ! empty( $item->classes ) && in_array( 'menu-item-has-children', $item->classes ) ) { return $item_output . '<svg class="chevron-down" fill="#ffffff" xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><path fill="#ffffff" d="M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"/></svg>'; } return $item_output; } add_filter( 'walker_nav_menu_start_el', 'parent_menu_dropdown', 10, 4 );
Leave a Reply