Our blog, keeping you up-to-date on our latest news.

 

Removing the Default Tooltip in a WordPress Menu

September 9, 2010 at 6:56 pm | Blog | No comment

 

My friend is working on a wordpress theme these days, and he found that there was an annoying tooltip in the menu, which will cover the sub menu. so he asked me how to remove the redundant tooltip in the wp_list_pages generated menu bar. see the above image.

I think others should also have this problem. So, we decide to share this tip with all.

his code is:

1
$page_list =wp_list_pages('exclude=1,2&title_li=&sort_column=menu_order');

if looked into the generated html code, it is something like this:

The default tooltip is actually the “title” attribute of the hype link. So to remove it, we need to remove the title attribute.

we can use preg_replace to replace the “title” with and empty string.

A little modification to his code to:

1
2
3
$page_list =wp_list_pages('exclude=1,2&title_li=&sort_column=menu_order&echo=0');
$page_list = preg_replace('/title=\"(.*?)\"/','',$page_list);
echo $page_list;

as we have to manipulate the html snippet before print it out, we use “echo=0″ to turn off the default print out function, we will manually call “echo” to print it out.

<< Back to Blog Discuss this post

 
Comments are closed.