{"id":897,"date":"2013-01-07T12:04:41","date_gmt":"2013-01-07T17:04:41","guid":{"rendered":"http:\/\/www.alquier.org\/linfa\/work\/?p=897"},"modified":"2013-01-07T12:04:41","modified_gmt":"2013-01-07T17:04:41","slug":"replace-text-by-an-image-with-jquery","status":"publish","type":"post","link":"http:\/\/www.alquier.org\/laurent\/sites\/2013\/01\/07\/replace-text-by-an-image-with-jquery\/","title":{"rendered":"Replace text by an image with jQuery"},"content":{"rendered":"<p>Since tweets are backed up automatically in this blog and prefixed with &#8216;Tweet:&#8217;, I thought it would be better to replace the prefix by a Twitter icon.<\/p>\n<p>jQuery can do that nicely:<\/p>\n[code]\n<p>jQuery(&#8216;h2 a&#8217;).html(function(i,html) {<br \/>\n    return html.replace(\/Tweet\\:\/g, &#8216;<img decoding=\"async\" src=\"\/path\/to\/twitter_icon.png\" alt=\"' + html + '\" \/>&#8216;);<br \/>\n});<\/p>\n[\/code]\n","protected":false},"excerpt":{"rendered":"<p>Since tweets are backed up automatically in this blog and prefixed with &#8216;Tweet:&#8217;, I thought it would be better to replace the prefix by a Twitter icon. jQuery can do that nicely: [code] jQuery(&#8216;h2 a&#8217;).html(function(i,html) { return html.replace(\/Tweet\\:\/g, &#8216;&#8216;); }); [\/code]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[123,1],"tags":[146],"class_list":["post-897","post","type-post","status-publish","format-standard","hentry","category-tips","category-uncategorized","tag-jquery","xfolkentry","clearfix"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8frwa-et","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/posts\/897","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/comments?post=897"}],"version-history":[{"count":0,"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/posts\/897\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/media?parent=897"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/categories?post=897"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/tags?post=897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}