I've got a default main menu:
wp_nav_menu();
But it gives a list of links in a form:
(...)
<a href="link" title="PageName">PageName</a>
(...)
The very important question is, how to force WP to display it like:
(...)
<a href="link">PageName</a>
(...)
I don't like the yellow boxes appearing every time I hover anything in menu.
I know it's possible, because I've seen it working, but no idea how? Filters maybe? Any ideas?
I've got a default main menu:
wp_nav_menu();
But it gives a list of links in a form:
(...)
<a href="link" title="PageName">PageName</a>
(...)
The very important question is, how to force WP to display it like:
(...)
<a href="link">PageName</a>
(...)
I don't like the yellow boxes appearing every time I hover anything in menu.
I know it's possible, because I've seen it working, but no idea how? Filters maybe? Any ideas?
Share Improve this question asked Apr 3, 2011 at 2:14 WordpressorWordpressor 5,05119 gold badges70 silver badges102 bronze badges4 Answers
Reset to default 4The title is an accessibility attribute that helps users with screen readers. It is part of the recommended WC3 standard for navigation items. Just think about that before you decide to eliminate it because you find it annoying.
Rather than modifying the PHP code, you could think about removing it after it's loaded. It's very easy to do this with jQuery. First, add this to your functions.php
file:
wp_enqueue_script('jquery');
Next, in your site.js
file, add this code:
<script type="text/javascript" > jQuery(document).ready(function($){ $('.nav li a').removeAttr('title'); } </script>
Again, I don't really recommend doing this, but this is how to accomplish it.
I'm pretty sure if you clear the "Title Attribute" field in the Appearance > Menu
editor that the titles will be removed from the links:
I have had the same problem and I solve this via wp.
if you ( as like as me before ) cannot see the title attribute in wp menu, check this :
- Go to Appearance > Menus.
- In the upper right corner ( mine was left corner ! ), click on Screen Options and ensure the "lable" boxes is checked.
- now you can edit or remove the label text in menu item.
The accepted solution is a jQuery jerky solution. This is the Wordpress PHP solution:
Add to your functions.php this:
/* REMOVE TITLES ON MENU */
function my_menu_notitle( $menu ){
return $menu = preg_replace('/ title=\"(.*?)\"/', '', $menu );
}
add_filter( 'wp_nav_menu', 'my_menu_notitle' );
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745076758a4609881.html
评论列表(0条)