Add Pinterest to Social Counter Widget

Posted in: Newspaper
Post count: 2

Seems like an oversight with how comprehensive that widget is with other social media accounts. Is this planned for a future release, and/or is there an easy way to add myself?

Post count: 854

hi,
thanks for the suggestion, we will talk about this . If you want to add it yourself you can find the files in the plugins directory -> td-social-counter directory

Thanks for you message.
Radu A.

Post count: 4

Hello Radu, could you be a bit more specific on how to ad the Pinterest counter?
I really need a pinterest counter, pinterest is our most important social media site, next to Facebook.
I tried some copy-paste work in the td-social-counter.php and the td_social_api.php files and changed the URL’s a bit. But luck wasn’t that easy to find today 🙂

Post count: 854

hi,

http://screencast.com/t/uZeOe1b53M

http://screencast.com/t/u8W87LDIiI

http://screencast.com/t/4m3o3bb4UPY
in the last picture is the code that actually connects to pinterest and takes the number.
you can do it either thru pinterest api or take a look here : http://screencast.com/t/qJfVwunr , we download the source of the page and using regular expression take the social number.

my advice is to hire a programmer for this task.

Thanks for you message.
Radu A.

Post count: 49

Radu (or anyone else),

Have you or anyone you know of done this successfully? I am looking to add a pinterest line to the social counter as my company has a big presence there.

I added and modified (successfully) the code from your 1st and 2nd screenshots. When I got to your 3rd and 4th screenshots, your arrows point to facebook and twitter code examples. You mention hiring a developer or going through the pinterest API, but I coulnd’t find any that information on their site or elsewhere.

Do you happen to have any working examples of pinterest code in “td_social_api.php” since you last posted in here?

Has anyone else gotten it to work?

Thanks a ton, keeping my fingers crossed.

Post count: 49

PS.. please let me know if there’s no way you guys can give additional support with adding a pinterest counter. At the moment, I’m still hoping.

Post count: 780

Hi,

I’ve added this to our issue tracker and if more people request this we will implement it. We have over 140 feature requests and we have to pick very carefully what we implement.

Radu O.

Post count: 6

Hi,

Is there any update on pinterest social counter, is it available?

Its a must have feature and we will appreciate your support.

Thank you.

http://www.rivaji.com
built with newspaper theme

Post count: 30

Is there a place we can vote on or request this feature? I would like to had it added as well. With pinterest being as big as it is, it only makes sense to add it.

Post count: 6600

Hi,

We will consider this for the next updates, unfortunately I can’t give an
ETA on this as we work hard on the development, updates, fixes and support.

Thanks

Post count: 9544

If you’re desperate for Pinterest support and can’t code the hack yourself, you can always use something like AddThis, which is a plugin we’ve used quite a bit the past several years, and has support for specifying just the share buttons you want, sizes, and location, as well as a new “cumulative shares” which people seem to like.

Post count: 2

I’ll go ahead and add my vote for the Pinterest addition.

Post count: 12

Hey guys, I just added this to the plugin myself. Similar to the twitter count extraction mentioned above, it simply grabs the follower count from the meta tag on the pinterest user page itself.

This would go in td_social_api.php function get_social_counter
case 'pinterest':
$td_data = @$this->get_url("http://www.pinterest.com/$user_id");
$pattern = '/<meta.*property="pinterestapp:followers".*content="(.*)".*>/';
preg_match($pattern, $td_data, $matches);
if (!empty($matches[1])) {
$buffy_array = (int) $matches[1];
}
break;

That was the hard part. The rest is easy stuff:

td-social-counter.php function get_social_network_meta
case 'pinterest':
return array(
'button' => __td('Follow'),
'url' => "https://www.pinterest.com/$user_id",
'text' => __td('Followers'),
'api' => $td_social_api->get_social_counter($service_id, $user_id),
);
break;

td-social-counter.php function get_map
array(
"param_name" => "pinterest",
"type" => "textfield",
"value" => "",
"heading" => __("Pinterest id:", TD_THEME_NAME),
"description" => "",
"holder" => "div",
"class" => ""
),

Works for me but use at your own risk.

Post count: 6600

Thanks @moregoodfoundation for sharing!

Post count: 38

Hi @moregoodfoundation, thanks for your code examples but for some reason it’s not returning the follower count for me. Everything else appears to be working. The meta tag for our follower count is…

<meta name="pinterestapp:followers" content="40038">

Strange!

Post count: 12

Oh interesting. In that case, just change the pattern to use “name” instead of “property”
$pattern = '/<meta.*name="pinterestapp:followers".*content="(.*)".*>/';
Also keep in mind that unless you also modify the code to refresh the cache, you won’t see the followers update for 3 hours.

Post count: 12

Or perhaps something more robust:
$pattern = '/<meta.*(name=|property=)"pinterestapp:followers".*content="(.*)".*>/';

Post count: 12

But the more robust version also calls for a change of index. So the updated code would be:
td_social_api.php function get_social_counter
case 'pinterest':
$td_data = @$this->get_url("http://www.pinterest.com/$user_id");
$pattern = '/<meta.*(name=|property=)"pinterestapp:followers".*content="(.*)".*>/';
preg_match($pattern, $td_data, $matches);
if (!empty($matches[2])) {
$buffy_array = (int) $matches[2];
}
break;

Post count: 12

And for those interested in forcing cache refresh:
In td_social_api.php, on the second line of functon get_social_counter()
change:
if ($this->in_cache($service_id, $user_id) === false) {
to
if (true/*$this->in_cache($service_id, $user_id) === false*/) {
then refresh a page that has the social counter widget on it, and then change the code back.
It is important that you put it back, otherwise every visit to that page will trigger count checks.

Post count: 25

Hi –

I followed your tips for adding pinterest and getting the followers to show, but it is still showing a 0 count. Does the latest suggestion actually pull in the count?

Post count: 75

I find the files to make changes but the cntent is not the same.
Are we making all these change inside the plugin?

wp-content/plugins/td-social-counter

td-social-counter.php has only this
<?php

/*

Plugin Name: tagDiv Social Counter

Plugin URI: http://tagdiv.com

Description: Social counter for wordpress. Widget and visual composer block.

Author: tagDiv

Version: 2.7

Author URI: http://tagdiv.com

*/

// load the api

require_once 'td_social_api.php';

//$td_social_api = new td_social_api();

//print_r($td_social_api->get_google_plus('106192958286631454676'));

//print_r($td_social_api->get_twitter('tagDiv'));

//print_r($td_social_api->get_vimeo('brad'));

//print_r($td_social_api->td_cache);

//$td_social_api->set_cache('test1', 'user_id', 'data');

//echo $td_social_api->get_cache('test1', 'user_id');

//$td_social_api->set_cache('ra2', 'raid', 'data');

//print_r($td_social_api->get_facebook('tagdiv'));

//print_r($td_social_api->get_youtube('rathegod'));

//$td_social_api->save_transient();

function td_social_counter_init() {

/**

* read the theme constants

*/

$td_theme_name = '';

if (defined('TD_THEME_NAME')) {

$td_theme_name = TD_THEME_NAME;

}

/**

* if we run Newspaper, we need to load this another way.

*/

if ($td_theme_name == 'Newsmag') {

// on 010 load the new version

include 'shortcode/td_social_counter_010.php';

}

elseif ($td_theme_name == 'Newspaper') {

// on newspaper load the legacy version

include 'shortcode/td_social_counter_009.php';

}

}

add_action('td_wp_booster_loaded', 'td_social_counter_init');

For exapmple i want to use youtube.com/c/channelname instead of youtube.com/user/
because automaticly directed to yout

Post count: 45

If you have Newspaper, you need to edit td_social_counter_009.php (in the “shortcode” folder)

Post count: 38

I’m really surprised this hasn’t been included in the theme by now – it’s such an important social network!

Any chance this will become integrated soon?

Post count: 7909

Hi,

We work a lot for version 5 of the theme and I cannot provide an exact date for this implementation, but we certainly plan to add more networks in future updates.

Thanks!

Viewing 24 posts - 1 through 24 (of 24 total)
You must be logged in to reply to this topic.