• steelsky

    (@steelsky)


    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

Viewing 15 replies - 1 through 15 (of 24 total)
  • 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.

    iridiax

    (@iridiax)

    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:

    https://codex.www.ads-software.com/Template_Tags

    Thread Starter steelsky

    (@steelsky)

    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?

    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.

    Thread Starter steelsky

    (@steelsky)

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

    Thread Starter steelsky

    (@steelsky)

    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:
    https://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?

    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.

    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.

    Thread Starter steelsky

    (@steelsky)

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

    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.

    Thread Starter steelsky

    (@steelsky)

    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?

    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.

    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!

    apljdi
    ditto the post above.
    I’m working on a site for a friend – https://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.

    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.

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Disabling tooltips’ is closed to new replies.