Family Encyclopedia >> Electronics

How to Add the Pinterest Pin It Button to Your WordPress Blog

Recently, while monitoring our blog stats, a new source of traffic was showing up enough for us to notice. This traffic source was Pinterest. We started using the platform and saw great potential in it, therefore we have added it to List25. In this article, we'll show you how to add the Pinterest "Pin It" button to your WordPress blog.

How to Add the Pinterest Pin It Button to Your WordPress Blog

Adding a Pinterest Pin it button using the plugin

The easiest way to add a Pinterest “Pin It” button to your WordPress site is by using a social sharing plugin. We recommend using a floating Social Bar, which we use on our own sites. First you need to install and activate the floating social bar plugin. After installation, you need to go to Settings »Floating social bar to configure the plugin.

How to Add the Pinterest Pin It Button to Your WordPress Blog

Simply drag and drop the Pinterest button to the Social Services Enabled area, along with any other buttons you'd like to display and save your settings.

Manually adding a Pinterest Pin it button in WordPress

The first thing you need to do is paste the following script into your footer.php file just before the closing body tag.

 (function () window.PinIt = window.PinIt || loaded: false; if (window.PinIt.loaded) devuelve; window.PinIt.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) ;) (); 

Once you've done that, you can add the following code to your single.php file to a location of your choice:

 ID), 'full'); ?> & media = & description = "count-layout =" vertical "> Pin It 

Basically, the code shown above is the extraction of your featured image, your post title as a description, and the post URL. It is designed for vertical share button. If you want to place the share button horizontally, simply change the count layout parameter to horizontal.

We hope this helps. PS If you're on Pinterest, follow Syed Balkhi.

Pinterest shortcode

Update:One of our users wanted to create a shortcode for the Pinterest "Pin It" button. You can easily do this by pasting the following code into your theme's functions.php file or your site's plugin file:

 ID), 'full'); devolver 'ID)). '& media ='. $ pinterestimage [0]. '& description ='. get_the_title (). '"count-layout =" vertical "> Pin It'; add_shortcode ('pin', 'get_pin');?>