Maxime Gfeller
asked 7 years ago

Hi,

I am trying to put the aggregate social share count below each article’s title on the home page and in certain widgets. Is there an easy way to do this? Where can I find the variable?

Best regards,

2 Answers
DominicStaff
answered 7 years ago

Hi,
At the moment, our theme does not support to put the aggregate social share count below each article’s title on the home page and in certain widgets, please tell me detail about widget name that you want to display.
Regards,

maxime0010
replied 7 years ago

Hi,
Thanks for your answer.
Most of the widgets we use are News Grid ones. Our goal is to display the shares (either aggregate or just facebook and twitter separately for instance) next to the comments count.

dominic Staff
replied 7 years ago

I have checked. Please send me username & password of your site (via private answer) I will help you resolve it.

Allen
answered 7 years ago

@Maxime Gfeller: hi , just taking a look at your site, about the sharing of facebook, the number of share that you see in the grid and in single post is different.
I’ll demonstrate on your post : "Parc zoologique de Ben Aknoun/ Rassemblement de protestation contre la maltraitance des animaux"

This will be the API link of that post to get the share : http://api.facebook.com/restserver.php?method=links.getStats&format=json&urls=http://www.algerie-focus.com/2015/11/parc-zoologique-de-ben-aknoun-rassemblement-de-protestation-contre-la-maltraitance-des-animaux/

You will see this : "share_count":338,"like_count":936,"comment_count":332,"total_count":1606,

And , in the share of our theme , we get the "total_count" : 1606 ass you see in your single post, in the plugin you use , it’ll be "share_count":338 , so it’ll be different to each other because of that. to fix this problem , there are 2 ways :
1: change the plugin Posts Social Shares Count : by open file classes\share.count.php, go to line : 58 and change the code to : return isset( $json[0][‘total_count’] ) ? intval( $json[0][‘total_count’] ) : 0;
2: change the file : dw-focus.js and dw-focus.min.js, find this code :

 else if(json.data && json.data.length > 0 && typeof json.data[0].total_count !== "undefined"){ //Facebook total count
          count += parseInt(json.data[0].total_count, 10);
        }

and change it to :

 else if(json.data && json.data.length > 0 && typeof json.data[0].share_count!== "undefined"){ //Facebook total count
          count += parseInt(json.data[0].share_count, 10);
        }

And please refresh our cached , hope this help.

maxime0010
replied 7 years ago

This is awesome, thank you very much!

Powered by DW Question & Answer Pro