Themekraft / _tk

Themekraft Starter Theme
GNU General Public License v3.0
430 stars 158 forks source link

Navwalker Fix #96

Open konradsroka opened 7 years ago

konradsroka commented 7 years ago

From: Paul Solomon Subject: _tk theme bug report

Message Body: Hi Guys,

I’m a huge fan of your _tk starter theme; thank you so much for making it available!

I recently found two issues with the theme’s bootstrap-wp-navwalker.php file.

When I edit WordPress menus from the admin area, I found that the “title” attribute value of links in the menu was always output as the “navigation label” value, rather than the “title attribute” value.

I also found that the glyphicon that wraps the tag anchor text was created with a separate class value for each word in the “title attribute” value, rather than a a single class with hyphen-separated “title attribute” value.

I made two changes to the bootstrap-wp-navwalker.php file which fixed this.

At around line 79, I removed this: $atts['title'] = ! empty( $item->title ) ? strip_tags($item->title) : '';

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

That results in the correct title attribute being generated.

At around line 113, I removed this: $item_output .= ' ';

And replaced it with this: $item_output .= ' ';

That results in the proper class value being generated.

Hope that’s helpful!

hommealone commented 6 years ago

Thanks for opening this bug report for me. Some of the code never made it into this issue.

At around line 113, I removed this: $item_output .= '<a'. $attributes .'><span class="glyphicon ' . str_replace(" ","-",strtolower(esc_attr( $item->title ))) . '"></span>&nbsp;';

Replace that with this: $item_output .= '<a'. $attributes .'><span class="glyphicon ' . strtolower( str_replace( ' ', '-', esc_attr($item->attr_title) ) ) . '"></span>&nbsp;';

hommealone commented 6 years ago

Without these changes, I find that every menu item gets a title tag, and the title tag is always equal to the anchor text. This is pointless (right?) and the resulting tooltips often obscure the menu or make navigation more confusing. With these changes, the "title" field in the menu editor GUI is actual usable, and the editor has the option to leave it blank if they do not want a link title tooltip.

konradsroka commented 6 years ago

thanks mate, we'll check this for the next update, sorry we do not have an ETA for this right now though