Pinterest is all the rage these days. People just love pinning up pictures and graphics like there is no tomorrow. If you have a WordPress blog, then you can add the Pin It button to your blog pretty quickly. Here is what you need to do:
Copy and paste the following code right before the closing </body> tag in your theme file footer.php:
<script type="text/javascript">
(function() {
window.PinMe = window.PinIt || { loaded:false };
if (window.PinMe.loaded) return;
window.PinMe.loaded = true;
function async_load(){
var s = document.createElement("script");
s.type = "text/javascript";
s.async = true;
s.src = "http://assets.pinterest.com/js/pinit.js";
var x = document.getElementsByTagName("script")[0];
x.parentNode.insertBefore(s, x);
}
if (window.attachEvent)
window.attachEvent("onload", async_load);
else
window.addEventListener("load", async_load, false);
})();
</script>
Once you have done that, make sure you update the footer.php file, or reupload it if you are editing the footer.php file any other way. You want the new version in place. Then, paste the following code into your single.php theme file wherever you deem appropriate. You might have to experiment a bit to realize the best possible location of the button for your blog.
<?php $pinterestimage = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); ?>
<a href="http://pinterest.com/pin/create/button/?url=<?php echo urlencode(get_permalink($post->ID)); ?>&media=<?php echo $pinterestimage[0]; ?>&description=<?php the_title(); ?>" class="pin-it-button" count-layout="vertical">Pin It</a>
Now, here is what this button code does: Wherever you place the button code in single.php, on each post page there will be a Pin It Button. Once clicked, the code will pop open a little Pinterest window, and it will use the featured image of that post as the submission pic. Similar to this:
There you go! Play around with it a little and you will find what works best for your blog. If you aren’t seeing any image in the pop up then your post doesn’t have a featured image specified for it. For best practices, always make sure you classify one image of each post as a featured image, because many plugins and buttons use the featured image slot.
Author: James Junior
I am a mid-thirties Writer and Internet Marketer from NY.
You are the damn savious of the pinterest people!
You are the damn saviour of the pinterest people! (you can delete that last typo comment). Thanks again! This saved me bunches of time trying to figure out how to write this out.
I’m very impressed by how you have represented the information in this article. It’s apparent that you’ve done some extensive research. Thanks for this input. http://www.samsung1080phdtv.net/
Hmm, the image doesn’t show when I add this. Only the anchor text.
You managed to really load this article up with information that is of real value. I appreciate good writing, and this is really good. I agree with the points you make here. Very nice work.
Many ideas have been written with standard views from what you wrote, but never have I seen such conviction and determination in the writing such a positive and pleasing document.
thanks! great web site. thank you for the information this site is amazing. very well developed with great information.http://www.transportadoraramos.net
is there any way to add pin button in thesis theme without plugin?
Wow, awesome blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your web site is wonderful, let alone the content!. Thanks For Your article about How to Add the Pinterest Pin It Button To Your WordPress Blog | BloggingPro .