1

I'm using twentyseventeen theme as base to design my own, but when i use wp_nav_menu to print menus, it adds some unwanted svg elements which break my design. Elements are like:

<svg class="icon icon-angle-down" aria-hidden="true" role="img"> 
<use href="#icon-angle-down" xlink:href="#icon-angle-down"></use> </svg>

How can i disable this?

1
  1. Copy functions.php from the parent theme into your child theme.

  2. Edit functions.php to remove the offending SVGs.

NOTE: if wp_nav_menu() is called from another file (e.g., header.php), copy and edit that one instead.

1

Go to inc/icon-functions.php file.

There is a code segment like this.

function twentyseventeen_dropdown_icon_to_menu_link( $title, $item, $args, $depth ) {
    if ( 'top' === $args->theme_location ) {
        foreach ( $item->classes as $value ) {
            if ( 'menu-item-has-children' === $value || 'page_item_has_children' === $value ) {
                $title = $title . twentyseventeen_get_svg( array( 'icon' => '' ) );
            }
        }
    }

    return $title;
}
add_filter( 'nav_menu_item_title', 'twentyseventeen_dropdown_icon_to_menu_link', 10, 4 );

Delete or comment this segment. This will remove svg dropdown icons from nav menu.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.