wp-bootstrap / wp-bootstrap-navwalker

A custom WordPress nav walker class to fully implement the Twitter Bootstrap 4.0+ navigation style (v3-branch available for Bootstrap 3) in a custom theme using the WordPress built in menu manager.
https://wp-bootstrap.github.io/wp-bootstrap-navwalker/
GNU General Public License v3.0
3.37k stars 1.94k forks source link

Bug in navwalker #428

Closed afterimagedesigns closed 3 years ago

afterimagedesigns commented 5 years ago

Incorrect data in title attribute and it’s causing problems in some cases.

A client once filed me a bug regarding with the title attribute issue. There seems a problem between these lines

$atts['title'] = ! empty( $item->title ) ? $item->title : '';

Where it should say:

$atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';

I'm not sure if this is right. Can you please check this on your end which code is right?

IanDelMar commented 5 years ago

It seems as this is a result of this code

if ( empty( $item->attr_title ) ) {
    $atts['title'] = ! empty( $item->title ) ? strip_tags( $item->title ) : '';
} else {
    $atts['title'] = $item->attr_title;
}

Here the WP Bootstrap nav walker deviates from the WordPress nav walker. While the latter does not default to anything if no title attribute is specified, the first defaults to the menu item title.

IanDelMar commented 4 years ago

@pattonwebz Fixed in #468

IanDelMar commented 3 years ago

As of #468 no default value is set to the title attribute.