{"id":716,"date":"2012-08-09T18:36:08","date_gmt":"2012-08-09T18:36:08","guid":{"rendered":"http:\/\/www.sitekickr.com\/blog\/?p=716"},"modified":"2012-08-09T18:36:08","modified_gmt":"2012-08-09T18:36:08","slug":"painterest-pinterest","status":"publish","type":"post","link":"https:\/\/www.sitekickr.com\/blog\/painterest-pinterest\/","title":{"rendered":"Painterest, I mean Pinterest"},"content":{"rendered":"<p>Yes, my most recent Pinterest integration was painful, but it actually paved the way for a new method of automating Pinterest buttons. At least for me.<\/p>\n<p>A couple months ago, when grabbing the &quot;Pin it&quot; button code from Pinterest, I was not required to provide the actual image URL. Apparently, this is now required, leading to a huge amount of work on the behalf of the site developer.<\/p>\n<p>It could be assumed that most sites with images are built with some sort of template, and applying the Pinterest button would be straightforward. But what happens when we don&#39;t have a template system, but rather a CMS, where there aren&#39;t any hard-and-fast rules about where to expect images.<\/p>\n<p>Without drifting too much here, I&#39;d like to introduce my new method of applying the Pin it button:<\/p>\n<h3>The jQuery<\/h3>\n<p><code>$(&#39;img&#39;).each(function() {<br \/>\n\t&nbsp;&nbsp;&nbsp; $(this).before(&#39;&lt;a href=&quot;http:\/\/pinterest.com\/pin\/create\/button\/?url=&#39; + location.href + &#39;&amp;media=&#39; + $(this).attr(&#39;src&#39;) + &#39;&amp;descrpition=&#39; + $(this).attr(&#39;alt&#39;) + &#39;&quot; class=&quot;pin-it-button&quot; count-layout=&quot;none&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;\/\/assets.pinterest.com\/images\/PinExt.png&quot; title=&quot;Pin It&quot; \/&gt;&lt;\/a&gt;&#39;);<br \/>\n\t});<\/p>\n<p>\t(function() { var ga = document.createElement(&#39;script&#39;); ga.type = &#39;text\/javascript&#39;; ga.async = false; ga.src = &#39;\/\/assets.pinterest.com\/js\/pinit.js&#39;; var s = document.getElementsByTagName(&#39;script&#39;)[0]; s.parentNode.insertBefore(ga, s); })();<\/p>\n<p>\t$(&#39;img&#39;).parent().addClass(&#39;pin-it-wrapper&#39;);<br \/>\n\t<\/code><\/p>\n<p>&nbsp;<\/p>\n<h3>The CSS<\/h3>\n<p><code>.pin-it-wrapper iframe { position: absolute; }<br \/>\n\t.pin-it-wrapper img { border-radius: 3px 0 0 0; }<br \/>\n\t<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>This is a nifty way to drop a Pin It button &quot;on top of&quot; each image on the site, located in the upper-left corner of the image.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yes, my most recent Pinterest integration was painful, but it actually paved the way for a new method of automating Pinterest buttons. At least for&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"amp_status":""},"categories":[12,5],"tags":[196],"_links":{"self":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/716"}],"collection":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/comments?post=716"}],"version-history":[{"count":1,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/716\/revisions"}],"predecessor-version":[{"id":717,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/716\/revisions\/717"}],"wp:attachment":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media?parent=716"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/categories?post=716"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/tags?post=716"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}