{"id":799,"date":"2008-04-15T11:28:23","date_gmt":"2008-04-15T09:28:23","guid":{"rendered":"http:\/\/planetozh.com\/blog\/?p=799"},"modified":"2008-04-15T11:30:38","modified_gmt":"2008-04-15T09:30:38","slug":"how-to-use-wordpress-25-tooltips","status":"publish","type":"post","link":"https:\/\/planetozh.com\/blog\/2008\/04\/how-to-use-wordpress-25-tooltips\/","title":{"rendered":"How-To: Use WordPress 2.5 Tooltips"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/planetozh.com\/blog\/wp-content\/uploads\/2008\/04\/tooltip.gif\" alt=\"\" title=\"tooltip\" width=\"200\" height=\"89\" class=\"alignleft size-full wp-image-797\" \/>Go to your blog admin area, head to the &quot;Write&quot; page, move your mouse over the &quot;Add media&quot; 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.<\/p>\n<p>First, in the HTML output of your plugin page, add a new classname &mdash; say &quot;givemesometips&quot; &mdash; to some elements, and give them a meaningful title.<\/p>\n<div id=\"ig-sh-1\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">HTML<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">p<\/span>&gt;<\/span>The question mark hides a tooltip! <span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">span<\/span> <span style=\"color: #000066\">class<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;givemesometips&quot;<\/span> <span style=\"color: #000066\">title<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;Hello, I am a tip&quot;<\/span>&gt;<\/span>?<span style=\"color: #009900\">&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">span<\/span>&gt;&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">p<\/span>&gt;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">p<\/span>&gt;<\/span>This image too! <span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">img<\/span> <span style=\"color: #000066\">src<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;someimage.gif&quot;<\/span> <span style=\"color: #000066\">alt<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;some image&quot;<\/span> <span style=\"color: #000066\">title<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;I am a tip, too!&quot;<\/span> <span style=\"color: #000066\">class<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;givemesometips&quot;<\/span> <span style=\"color: #66cc66\">\/<\/span>&gt;&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">p<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>Now, somewhere in your plugin page, add this Javascript call:<\/p>\n<div id=\"ig-sh-2\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">HTML<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">script<\/span> <span style=\"color: #000066\">type<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;text\/javascript&quot;<\/span>&gt;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">jQuery(document).ready( function() {<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; jQuery('.givemesometips').tTips(); \/\/ tooltipize elements with classname &quot;givemesometips&quot;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">});<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">script<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>And that&#39;s it. If your hamster cannot do this, consider upgrading it! For your convenience, here is a sample dummy plugin with <a href=\"http:\/\/planetozh.com\/blog\/wp-content\/uploads\/2008\/04\/tooltip_example.zip\">tooltip examples<\/a> in the page it creates under the Setting menu. Have fun!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Go to your blog admin area, head to the &quot;Write&quot; page, move your mouse over the &quot;Add media&quot; 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[297,245,277],"class_list":["post-799","post","type-post","status-publish","format-standard","hentry","category-published","tag-tooltip","tag-wordpress","tag-wordpress-snippet"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/799","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=799"}],"version-history":[{"count":0,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/799\/revisions"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/categories?post=799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/tags?post=799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}