Mike
asked 7 years ago

Google+ Social icon doesn’t increment from ‘0’ despite shared many times in DW Focus

Google+ Social icon doesn’t increment from ‘0’ despite shared many times in DW Focus theme. Can you please fix this up asap.

3 Answers
Jackie Lord
answered 7 years ago

Updated!

Hi Mike,
To fix the issue, please add the following code lines to the file /functions.php, above β€œ?>”

function dw_get_plusones_share_count($url) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://clients6.google.com/rpc");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POSTFIELDS, '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"'.rawurldecode class="prettyprint"($url).'","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
$curl_results = curl_exec ($curl);
curl_close ($curl);
$json = json_decode class="prettyprint"($curl_results, true);
return isset($json[0]['result']['metadata']['globalCounts']['count'])?intval( $json[0]['result']['metadata']['globalCounts']['count'] ):0;
}

– Then, at the line 434 in the file /functions.php

replace

<li class="google"><i class="icon-google-plus-sign"></i><a href="https://plus.google.com/share?url=<?php echo $url; ?>" ><?php _e('Google +','dw_focus') ?></a><span>0</span></li> 

with

<li class="google"><i class="icon-google-plus-sign"></i><a href="https://plus.google.com/share?url=<?php echo $url; ?>" ><?php _e('Google +','dw_focus') ?></a><span><?php echo dw_get_plusones_share_count( $url ); ?></span></li>

Hope this helps,

Regards,
Rambu

Mike
answered 7 years ago

Can you please include all the fixes in the DW Focus theme and then ship it with a new release. This will make the implementation clean.

We don’t want to touch the core files of your theme.

BigHug
replied 7 years ago

i sent an email to editor@mobilespie.com. please check it.

Murat Tekmen
replied 7 years ago

I want it also please.

muhabas
replied 6 years ago

I have the same problem and needs to fix please help Thanks.

dominic Staff
replied 6 years ago

Firstly, you can check your version. we have released the latest version 1.1.0. if you updated the theme and still face there issue, you can send me username & password of your site (via private answer) for further checking.

Mike
answered 7 years ago

Hi Rambu,

The code is incorrect. It is displaying same static value (15) for all posts!

Please look into it.

BigHug
replied 7 years ago

I have updated code again and email new file to your email

Mike
replied 7 years ago

Working now,,you can close this thread now..

Murat Tekmen
replied 7 years ago

Hi Rambu, can i get the updated code also please? Mine G+ not working aswell. πŸ™‚

Powered by DW Question & Answer Pro