Pinterest Followers display

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.

Read More

Any help would be appreciated.

Related posts

Leave a Reply

3 comments

  1. Maybe 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']);
    
  2. 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.