This post has been pinned (loading...) times.
I know this is a bit of a diversion from what Georgia usually writes about, so regular readers will probably just skip over this post. That's ok! This post is for bloggers (or website owners) who want to do something special with the "Pin It" button from Pinterest. Just think of it as a different kind of DIY....
Lately, Pinterest has been our top source of traffic. As I'm writing this, the most-pinned post on MoreLikeHome.net is the Outdoor Sectional. As of RIGHT NOW, it has been pinned 65,000 times. Pretty cool, right? For two reasons...first of all, because that's a lot of pins, secondly because that number is dynamic. Go ahead, refresh the page and see if it changes (it may take a few minutes for another person to pin it, or you could pin it yourself).
I've come up with a way to customize the output of the Pin It button in a few ways. First, as you saw above, it can output as simple text. You can insert this text anywhere, opening the possibility of making any kind of custom button you can think of with the number attached. Second, the number of pins can output as a complete number instead of the classic "65k+" output that is the only option Pinterest gives. (The "Vertical" layout is fixed-width, so it shows the full number until it passes 99,999, then it reverts to 100K+)
The number of pins in any post on MoreLikeHome.net is actually a composite of two numbers...pins from www.morelikehome.net and pins from morelikehome.blogspot.com. As the blog grew, we decided it would look more professional to have a custom domain, and changing domains meant losing all those pins. If we wanted the Pin It button to show the full count of pins, we would have to do something like this, showing both:
Another problem with the standard pin it button is it doesn't combine the pin counts associated with your site WITH and WITHOUT the leading "www". As an example, I checked one of our favorite blogs, ana-white.com, because they have a pin it button that says 47K+. When I tested it both ways I found:
ana-white.com/ - 47,767 pins
www.ana-white.com/ - 595 pins
It's not a lot, but the button should say 48K+.
Pinterest doesn't offer a solution for either of these problems, and they have no meaningful customer service, so I came up with a solution myself. And you're welcome to use it! Here's how:
Note: This will only work if you use the standard "Pin It" button from Pinterest or something formatted the same way.
The first thing you have to do is choose which format you want for your count number. The choices are:
If you choose classic, all your buttons will look exactly how they do now, you will just gain the option to insert the 64K+ anywhere you want and the option to combine two domains.
Secondly you will have to choose if will you be combining two domains. This will only work if they both have the exact same permalinks after the different domains. For instance, when we switched from morelikehome.blogspot.com to www.morelikehome.net, all the links carried over:
http://morelikehome.blogspot.com/2011/12/salt-dough-gift-tags.html
became:
http://www.morelikehome.net/2011/12/salt-dough-gift-tags.html
See? Exactly the same link after the changed domain name. This is how it usually works when you change domains, otherwise any links to the old domain are pretty much worthless.
After making those decisions, you simply replace the Pinterest header code:
<script src="//assets.pinterest.com/js/pinit.js" type="text/javascript"></script>
with my code:
Click to display code for single domain, classic format.
Insert this code in the header as a replacement for the Pinterest header code:
<script src='http://projects.morelikehome.net/code/pinit-single-classic.js' type='text/javascript'></script>
<script type='text/javascript'>
// Custom Pinterest code created by www.morelikehome.net
$(document).ready(function() {
loadPinterest();
});
</script>
And that's all! You're good to go!
Click to display code for single domain, full number format.<script src='http://projects.morelikehome.net/code/pinit-single-classic.js' type='text/javascript'></script>
<script type='text/javascript'>
// Custom Pinterest code created by www.morelikehome.net
$(document).ready(function() {
loadPinterest();
});
</script>
And that's all! You're good to go!
Insert this code in the header as a replacement for the Pinterest header code:
<script src='http://projects.morelikehome.net/code/pinit-single-fullnumber.js' type='text/javascript'></script>
<script type='text/javascript'>
// Custom Pinterest code created by www.morelikehome.net
$(document).ready(function() {
loadPinterest();
});
</script>
And that's all! You're good to go!
Click to display code for two-domain, classic format.<script src='http://projects.morelikehome.net/code/pinit-single-fullnumber.js' type='text/javascript'></script>
<script type='text/javascript'>
// Custom Pinterest code created by www.morelikehome.net
$(document).ready(function() {
loadPinterest();
});
</script>
And that's all! You're good to go!
Insert this code in the header as a replacement for the Pinterest header code:
<script src='http://projects.morelikehome.net/code/pinit-dual-classic.js' type='text/javascript'></script>
<script type='text/javascript'>
// Custom Pinterest code created by www.morelikehome.net
$(document).ready(function() {
var domainname1 = "http://www.morelikehome.net/";
var domainname2 = "http://morelikehome.blogspot.com/";
var d1 = encodeURIComponent(domainname1);
var d2 = encodeURIComponent(domainname2);
loadPinterest(d1,d2);
});
</script>
You will need to change domainname1 and domainname2 to match your domains. Use the whole name (including http:// at the beginning and / at the end). Domainname1 should be your primary domain, it is the one they will pin from if they click the new Pin It button.
Click to display code for two-domain, full number format.<script src='http://projects.morelikehome.net/code/pinit-dual-classic.js' type='text/javascript'></script>
<script type='text/javascript'>
// Custom Pinterest code created by www.morelikehome.net
$(document).ready(function() {
var domainname1 = "http://www.morelikehome.net/";
var domainname2 = "http://morelikehome.blogspot.com/";
var d1 = encodeURIComponent(domainname1);
var d2 = encodeURIComponent(domainname2);
loadPinterest(d1,d2);
});
</script>
You will need to change domainname1 and domainname2 to match your domains. Use the whole name (including http:// at the beginning and / at the end). Domainname1 should be your primary domain, it is the one they will pin from if they click the new Pin It button.
Insert this code in the header as a replacement for the Pinterest header code:
<script src='http://projects.morelikehome.net/code/pinit-dual-fullnumber.js' type='text/javascript'></script>
<script type='text/javascript'>
// Custom Pinterest code created by www.morelikehome.net
$(document).ready(function() {
var domainname1 = "http://www.morelikehome.net/";
var domainname2 = "http://morelikehome.blogspot.com/";
var d1 = encodeURIComponent(domainname1);
var d2 = encodeURIComponent(domainname2);
loadPinterest(d1,d2);
});
</script>
You will need to change domainname1 and domainname2 to match your domains. Use the whole name (including http:// at the beginning and / at the end). Domainname1 should be your primary domain, it is the one they will pin from if they click the new Pin It button.
<script src='http://projects.morelikehome.net/code/pinit-dual-fullnumber.js' type='text/javascript'></script>
<script type='text/javascript'>
// Custom Pinterest code created by www.morelikehome.net
$(document).ready(function() {
var domainname1 = "http://www.morelikehome.net/";
var domainname2 = "http://morelikehome.blogspot.com/";
var d1 = encodeURIComponent(domainname1);
var d2 = encodeURIComponent(domainname2);
loadPinterest(d1,d2);
});
</script>
You will need to change domainname1 and domainname2 to match your domains. Use the whole name (including http:// at the beginning and / at the end). Domainname1 should be your primary domain, it is the one they will pin from if they click the new Pin It button.
ALSO: If you don't have the following line (or a similar jquery include) in your header already:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
You need to add that above the new Pinterest code.
So that just leaves the text-only option. Once the header code is replaced, creating a text-only pin count is easy. Simply get the Pin It code just like you always do from the Pinterest goodies page, and change count-layout="horizontal" to count-layout="number". I also suggest removing the placeholder image (<img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" />) and replacing it with "(loading)".
So that's all! Are you willing to give it a try? You can always switch back or try the other format if you don't love it.... Leave a comment here if you use the code or if you have any problems with it. And if you consider my time valuable (debatable), consider crediting MoreLikeHome.net in some way on your page or link back to this post (please don't just copy and paste my instructions, that's just wrong). Enjoy!
*Code reverse-engineered from scripts belonging to Pinterest.com with help from this script*
Thanks so much! My counts weren't displaying correctly until I updated my header code with yours. I really appreciate you taking the time to post this!
ReplyDeleteI'm so glad it helped! My hubs is great at this kind of thing, I would be totally lost on my own. ;)
Deleteim a code dummie- just made the switch to a .com domain name from blogger. I am needing a little more help with this. Can you be a little more specific about all that i need to replace with my info? I made just 2 changes is that correct?
ReplyDeleteIn your case, you will need to paste the two-domain code in your header, replacing the old Pinterest code. Then make two replacements: Replace "http://www.morelikehome.net/" with your new .com address and replace "http://morelikehome.blogspot.com/" with your old blogspot address. Make sure you have the extra "jquery" code (mentioned after all the code options) somewhere in your header. If that doesn't work, let me know your new site address and I'll take a look!
Deletestill no luck, I think im doing something wrong.
Deletesrc='http://projects.morelikehome.net/code/pinit-dual-classic.js' type='text/javas'>
Delete< type='text/java'>
// Custom Pinterest code created by www.morelikehome.net
$(document).ready(function() {
var domainname1 = "http://www.littleonceboutique.com/";
var domainname2 = "http://littleonceboutique.blogspot.com/";
var d1 = encodeURIComponent(domainname1);
var d2 = encodeURIComponent(domainname2);
loadPinterest(d1,d2);
});
This is the code I used. I deleted or "tweaked" the "scrpt" so I could message you this. My site is www.littleonceboutique.com.
You're trying to use more than one script that work against each other. I sent you a Facebook message, hopefully my solution will work for you.
Delete