How would I go about showing my Pinterest followers in Wordpress? I tried this but it only displays the button letting users to follow my account, nothing about my followers.
Presumably, I can do this using the Pinterest API, but I'm unsure where to start.
Any help would be appreciated.
How would I go about showing my Pinterest followers in Wordpress? I tried this but it only displays the button letting users to follow my account, nothing about my followers.
Presumably, I can do this using the Pinterest API, but I'm unsure where to start.
Any help would be appreciated.
Share Improve this question edited Sep 3, 2013 at 12:10 asked Jun 21, 2013 at 1:21 user1853788user1853788 2- Did you try creating your widget using this link : business.pinterest.com/widget-builder/#do_pin_it_button It has a "Pin Count" option. Is your "data-pin-config" set? – Software Engineer Commented Jun 21, 2013 at 4:04
- it doesn't work. it only works for pins, not account itself. – user1853788 Commented Jun 21, 2013 at 4:18
3 Answers
Reset to default 14Maybe it will be helpful for someone. To get the number of account followers:
<?php
$metas = get_meta_tags('http://pinterest.com/pinterest/');
print_r($metas['pinterestapp:followers']);
Yes, you can use the Pinterest API. Install curl and use that in a PHP script. Example:
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://pinterestapi.co.uk/"""yourname"""/likes');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 0);
$json = curl_exec($ch);
curl_close($ch);
It's supposed to return something like this note that """yourname""" is your Pinterest account name:
{
"body": [
{
"href": "http://pinterest.com/pin/150026231307331200/",
"src": "http://media-cache-ec3.pinterest.com/upload/228979962274567868_qVshovBS_b.jpg",
"desc": "#london",
"user": "Louise Earl",
"via": "Kris Mitchell",
"board": "Ideal"
},
{
"href": "http://pinterest.com/pin/287104544965407998/",
"src": "http://media-cache-ec8.pinterest.com/upload/287104544965407998_z3kbynbX_b.jpg",
"desc": "hipsters vs old people",
"user": "Lucy Foulkes",
"via": false,
"board": "cool"
}
],
"meta": {
"count": 2
}
}
Since this returns a json string you´ll need to decode it.
$count = json_decode($json, true);
$count = $count['meta']['count'];
I don't know if curl is available when hosting your site on Wordpress but might be worth a try. In your case the "count" in that string is probably what you want.
I managed to do it with this plugin http://wordpress.org/plugins/pinterest-badge/
I added it as a widget. I made the number of pins = 0 and no title.
See screenshot below:
You can edit the styles to your liking as well as change the "Followed by..." text in the plugin files!