In: , ,
On: 2008 / 04 / 15 Viewed: 14117 times

Go to your blog admin area, head to the "Write" page, move your mouse over the "Add media" tiny icons: you probably had noticed it already, WordPress 2.5 comes with a neat tooltip function. Using it in your own plugins is so easy that a hamster could do it.

First, in the HTML output of your plugin page, add a new classname — say "givemesometips" — to some elements, and give them a meaningful title.

HTML:
  1. <p>The question mark hides a tooltip! <span class="givemesometips" title="Hello, I am a tip">?</span></p>
  2. <p>This image too! <img src="someimage.gif" alt="some image" title="I am a tip, too!" class="givemesometips" /></p>

Now, somewhere in your plugin page, add this Javascript call:

HTML:
  1. <script type="text/javascript">
  2. jQuery(document).ready( function() {
  3.     jQuery('.givemesometips').tTips(); // tooltipize elements with classname "givemesometips"
  4. });
  5. </script>

And that's it. If your hamster cannot do this, consider upgrading it! For your convenience, here is a sample dummy plugin with tooltip examples in the page it creates under the Setting menu. Have fun!

Related posts

Metastuff

This entry "How-To: Use WordPress 2.5 Tooltips" was posted on 15/04/2008 at 11:28 am and is tagged with , ,
Watch this discussion : Comments RSS 2.0. You can trackback this post from your own site

32 Blablas

    Pages: [1] 2 » Show All

  1. 1
    Malte Landwehr Germany »
    wrote, on 15/Apr/08 at 4:52 pm # :

    Cool advice, thanks for sharing. I just wrote "easily integrated tooltips" on my upgrading to wordpress 2.5 pro/con list. In the pro category obviously.

  2. 2
    Weblog Tools Collection » Blog Arc... United States »
    pingback on 15/Apr/08 at 8:52 pm # :

    [...] Wordpress. Go ahead, subscribe to our feed! You can also receive updates from this blog via email.How-To: Use WordPress 2.5 Tooltips Ozh has done it again! Have you noticed the cool little hover over tooltips on the WordPress 2.5 [...]

  3. 3
    René van Gellekom Netherlands »
    wrote, on 15/Apr/08 at 10:04 pm # :

    Thanks for the tips on these 'extras' but i prefer a good working version of wp 2.5 without the 'extras'.

  4. 4
    Tarun United States »
    commented, on 16/Apr/08 at 12:49 am # :

    Cool tips.

    Thank you.

  5. 5
    Throx Australia »
    replied, on 16/Apr/08 at 1:12 am # :

    Thanks for the nice tips, I still need some time to figure out everything in 2.5.

  6. 6
    Random WordPress 2.5 How-To’s :: W... United States »
    pingback on 16/Apr/08 at 2:09 am # :

    [...] How-to add WordPress 2.5 Tooltips on Your Plugin by Ozh. [...]

  7. 7
    Ronald United States »
    wrote, on 16/Apr/08 at 4:54 am # :

    Very good job Ozh. Very backwards compatible as well.

  8. 8
    sabbir Australia »
    replied, on 16/Apr/08 at 5:07 am # :

    thanks for the nice and easy follow tips.

  9. 9
    Gelay Bhutan »
    thought, on 16/Apr/08 at 6:09 am # :

    Thanks for the tip. Must try it out!!!

  10. 10
    WordZine China »
    trackback on 16/Apr/08 at 6:37 am # :

    ?? WordPress2.5 ?????...

    planetOzh ????????????????? WordPress2.5 ????????????????
    ????????????????????????? my_tTips???????? title ???
    ......

  11. 11
    martinsc Israel »
    replied, on 16/Apr/08 at 6:44 am # :

    very nice tip ;-)

  12. 12
    ketsugi United States »
    thought, on 16/Apr/08 at 6:58 am # :

    Thanks for the tips! This'll come in handy.

    My only worry is that if we have too many plugins adding a custom class for tooltips (all of which call the same js function) might it not get a little crowded? Wouldn't it be easier if WP Core simply defined a specific class for us to use and we all used that same class?

  13. 13
    Skylog » Blog Archive » link... Italy »
    pingback on 16/Apr/08 at 8:30 am # :

    [...] How-To: Use WordPress 2.5 Tooltips (tags: wordpress) [...]

  14. 14
    john Indonesia »
    thought, on 16/Apr/08 at 9:08 am # :

    Great plug-in, thanks

  15. 15
    hufang China »
    thought, on 16/Apr/08 at 10:56 am # :

    very good ,i think it is simple

  16. 16
    Mark Germany »
    said, on 16/Apr/08 at 12:13 pm # :

    Nice and short! Its always amazing to see that with jquery nice effects are so simple to create.

  17. 17
    amolpatil2k India »
    replied, on 16/Apr/08 at 6:00 pm # :

    Communism section is producing this error:

    Fatal error: Cannot use string offset as an array in /home/.batly/planetozh/planetozh.com/blog/wp-content/plugins/youfave/wp_ozh_youfave.php on line 163

  18. 18
    Kevin Paquet Philippines »
    thought, on 16/Apr/08 at 6:52 pm # :

    I don't really get what this is doing.
    Ahmm, what plugin page should I edit??

  19. 19
    Ozh France »
    wrote, on 16/Apr/08 at 9:52 pm # :

    ketsugi » There's no problem with this. Each plugin will define its own javascript applying tooltips on their own classname. One plugin page with class="mytip" and another plugin page with class="tooltip" won't interfere nor be loaded at the same time.

  20. 20
    Ozh France »
    wrote, on 16/Apr/08 at 9:54 pm # :

    amolpatil2k » Sometimes it breaks, yeah. I'll have to investigate :)

Pages: [1] 2 » Show All

Leave a Reply

Comment Guidelines or Die

  • HTML: You can use these tags: <a href=""> <em> <i> <b> <strong> <blockquote>
  • Posting code: Post raw code (no <> &lt; etc) within appropriate tags : [php][/php], [css][/css], [html][/html], [js][/js], [sql][/sql], [xml][/xml], or generic [code][code]
  • Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar.
  • Spam: Various spam plugins on patrol. I'll put pins in a Voodoo doll if you spam me.
  • I will mark as Spam test comments, all comments with SEO names (ie "My Cool Online Shop" instead of "Joe") or containing forum-like signatures.

Read more ?

Close
E-mail It