Themekraft / _tk

Themekraft Starter Theme

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Navwalker Fix

konradsroka opened this issue · comments

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!

  • Paul

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;';

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.

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