WordPress.org

Ready to get started?Download WordPress

Forums

Disabling tooltips (25 posts)

  1. steelsky
    Member
    Posted 5 years ago #

    Believe me that I've spent several hours on this one, but didn't find any answer.

    How do I disable tooltips?
    Specifically, where among the WordPress files is the function/code/script for tooltips? How do I change them for specific links?

    Thanks,
    S

  2. s_ha_dum
    Member
    Posted 5 years ago #

    Are you talking about the little pop-up that appears over hyperlinks? If so, that is done by the browser-- some browsers, anyway-- and not by any code in WP. Its basically an echo of the anchor's title attribute. View source and search for the 'tooltip' text. If you find title="tooltiptext" then that is what you are dealing with. To eliminate that you have to remove the title attribute. It is considered somewhat bad form to remove them though, as removing the title attribute breaks accessibility standards. To change the tooltiptext you have the find the code that is creating it-- mostly (but maybe not entirely) that means the theme and plugins.

    It is possible that your theme is using some other kind of tooltip, in which case the above doesn't apply.

  3. iridiax
    Member
    Posted 5 years ago #

    The tooltips on links are link title attributes (Google this for more info). To see if the titles can be removed, check the options for the particular template tag generating the links:

    http://codex.wordpress.org/Template_Tags

  4. steelsky
    Member
    Posted 5 years ago #

    Well, the thing is this - I have a header menu, which has links to pages. When going over each link, a sub-menu opens. The problem is that a tooltip also appears and covers the topmost sub-menu item.

    While I know this is a browser thing - it must get its information from the code. I also know that the text in the tooltip is the link/page title (so I don't want to remove the title, of course).

    I bet somewhere in the WordPress files there's a piece of code which tells the browser what to put in the tooltip. I wanna disable that so that the browser will not display the tooltip. Any thoughts?

  5. s_ha_dum
    Member
    Posted 5 years ago #

    If in fact it is the title attribute that you are seeing, there is no code in WP that does that. WP determines what goes in the title attribute but the tooltip is a browser thing. You can prove this to yourself pretty easily by disabling javascript and reloading the page. If you are still seeing the tooltip, it isn't WP. The only way WP has to make tooltips (or do anything else without a page reload) is javascript-- well, more or less-- so if you still see those popups with javascript disabled it ain't WP.

    Again, it is possible that you are talking about something different than I am. If you tell me your URL I can tell you for sure if the title attribute is your problem or not, although I've already told you how to figure this out for yourself.

  6. steelsky
    Member
    Posted 5 years ago #

    - disregard this (forgot to block the code). move to next post -

  7. steelsky
    Member
    Posted 5 years ago #

    apljdi - Yes, it makes sense it's a javascript thing. However, the javascript code most be somewhere in the WP files, no? Also, there must be a way to tell the browser not to present a tooltip.

    The URL is:
    http://adionim.com/WP/

    Notice the top tabs menu.
    Note that I use two browsers. In IE the tooltips appear, but in FF they don't.

    I have found this piece of code in the theme editor:

    <?php
    if($options['categorytabs']) {
    echo preg_replace('@\<li([^>]*)>\<a([^>]*)>(.*?)\<\/a>@i', '<li$1><a$2><span><span>$3</span></span>', wp_list_categories('show_count=0&echo=0&exlude=181&title_li='));
    }
    else {
    echo preg_replace('@\<li([^>]*)>\<a([^>]*)>(.*?)\<\/a>@i', '<li$1><a$2><span><span>$3</span></span>', wp_list_pages('echo=0&orderby=name&title_li=&'));
    }
    ?>

    It controls the top tabs menu (in the header.php). I see there's a call for "name&title", but I don't know how to tinker with it. Any suggestions on how to change this code (if it is indeed the issue)? Is these a way to change a page's title without changing its name? Maybe accessing the database? Will it help?

  8. iridiax
    Member
    Posted 5 years ago #

    I checked and they are the link title attributes generated by WordPress template tags like wp_list_pages. It is not javascript. Most browsers display these link titles as little "tooltips" that appear when you hover over the link. See this page.

  9. s_ha_dum
    Member
    Posted 5 years ago #

    Ok. Your site does appear to be loading a tooltips javascript. It isn't being loaded by WP exactly. Its being loaded by your theme. The tooltips function is in wp-content/themes/fusion/js/jusion.js. That said, I don't see a javascript tooltip in FF (on either Slackware or XP Pro), and I don't see it in IE7 on XP Pro either. What I do see in all cases is the browser based title attribute popup that we've been talking about. I'm not sure what you are seeing that I'm not. At any rate, the function call you want to look for is initTooltips. I'd guess that you'd find the function call in a theme header file or functions file.

  10. steelsky
    Member
    Posted 5 years ago #

    Is there any way to disable this? Like changing the wp_list_pages function or something?

  11. s_ha_dum
    Member
    Posted 5 years ago #

    You could edit the wp_list_pages function if you want, but core file edits are a pain when you upgrade. You are better of using the wp_list_pages filter, like so:

    function remove_title($input) {
      return preg_replace_callback('#\stitle=["|\'].*["|\']#',
        create_function(
          '$matches',
          'return "";'
          ),
          $input
        );
      }
    add_filter('wp_list_pages','remove_title');

    Add that to your theme's function file. This code comes with no warranties either explicit or implicit. :) It is very insufficiently tested but I think it works.

  12. steelsky
    Member
    Posted 5 years ago #

    Much appreciated, apljdi.

    When you say function file, do you mean functions.php?
    Also, after I add this - don't I have to "call upon" the function where needed?

  13. s_ha_dum
    Member
    Posted 5 years ago #

    Yes. 'Function file' is your theme's functions.php. No. You don't have to call the function. The add_filter part is actually a kind of function call. Anytime the WP hook 'wp_list_pages' is called, the function 'remove_title' will be called as well. This does work only for 'wp_list_pages' though. If that hook isn't called this function won't do anything.

    I should note that 'remove_title' isn't a very good function name. It's too generic. Someone else might think of it and then there would be a conflict. It is probably best to name the function something that is less likely to be duplicated-- steelsky_remove_title, or something like that.

  14. h3admin
    Member
    Posted 5 years ago #

    apljdi
    You have no idea how long I have searched the web to find an answer to that issue.
    I tried dozens of combinations of codes in functions.php and none worked. Until I tried your suggestion.

    It worked perfectly. Thank you so much!

  15. idread
    Member
    Posted 5 years ago #

    apljdi
    ditto the post above.
    I'm working on a site for a friend - http://bodysurfscotland.co.uk - and have a sub menu of categories below the pages menu.
    How do I add categories to your function call? (So that pages and categories are disabled)
    I've tried a few configurations using 'wp_list-categories' but am blind as far as writing PHP is concerned.

    Any suggestions will be greatly appreciated.

    Thanks.

  16. mattifesto
    Member
    Posted 5 years ago #

    I'm having this exact same problem. I list my categories to make a pull down menu and then the tooltips pop up as well and it's highly annoying.

    I was hoping use_desc_for_title=0 would do the trick but it doesn't seem to.

    Update:

    Since I'm using jQuery to make the menu anyway, I just added this line to my setup code:

    $("#pulldownmenu a").removeAttr("title");

    I was nervous about removing the title from all cases and this just removes them from the specific menu I want and won't if javascript isn't enabled. Works perfectly.

  17. jofolio
    Member
    Posted 4 years ago #

    hello!

    Just tried apljdi's disable tooltip method and it worked, however, it caused my main menu to completely disappear. Any idea on how to bring it back?

  18. Laneth Sffarlenn
    Member
    Posted 4 years ago #

    Hey, from another thread looking for the same solution, another member posting a link to a WP Plugin. It's served its purpose for me and might be worth a look-see for you all.

    "remove_title_tags.zip" - Remove Title Tags plugin:
    http://camp.woothemes.com/2009/06/remove-title-attributes-from-wp_list_categories-wp_list_pages-plugin/

  19. yorokobi
    Member
    Posted 4 years ago #

    apljdi, Great solution! Your code to add to functions.php fixed yet another case.

    Mine was drop down menus via CSS, and like the others the [censored] tooltip was getting in the way.

    Thanks a ton!

  20. Technokinetics
    Member
    Posted 4 years ago #

    If you're looking to disable tooltips for more than just Page lists (e.g. for category lists, archive menus, etc.), then I've just released a plugin that should help: http://wordpress.org/extend/plugins/remove-title-attributes/. Feedback to tim @ technokinetics.com appreciated.

    - Tim

  21. Bushtick
    Member
    Posted 4 years ago #

    A big thank you to apljdi for his snippet of code for the functions.php file - just tried it as a client was asking for it. Worked perfectly first time.

    Thanks a lot.

    Colin

  22. stevejs67
    Member
    Posted 4 years ago #

    Technokinetics - your plug-in works perfectly. Have it running on all my WP sites now. Thank you!

  23. seniortiago
    Member
    Posted 4 years ago #

    @mattifesto
    <?php $("#pulldownmenu a").removeAttr("title"); ?>

    where this code should be placed?

    also its needed to call

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"></script>

    jquery lib for this to work i guess :).

    I tried to put em both in templated header but then page isnt loading :/

  24. azoomer
    Member
    Posted 4 years ago #

    Thank you apljdi. I know the post is old but i really appreciate the trick you presented.

  25. keirj
    Member
    Posted 4 years ago #

    apljdi - thanks, that little function code worked for me.
    WP 2.91
    K

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags