Mirek Kroupa
asked 8 years ago

 I have shared on Google+, the counter is “0”. Coach Yoast WordPress SEO Plugin use. Twitter and FB fine.

3 Answers
BigHug
answered 8 years ago

Can you provide me your admin account for further checking and make a quick fix on your site?

BigHug
answered 8 years ago

Hi Mirek Kroupa, 
Can you help me by opening  the your theme functions.php file, go to line 1075 and replace 

   https://clients6.google.com/rpc

with

   https://clients6.google.com/rpc?key=YOUR_API_KEY

YOUR_API_KEY: is google api key, you can learn how to get it in this link https://developers.google.com/+/api/oauth#apikey
Regards

Mirek Kroupa
answered 8 years ago

That does not help. I used the function from v.1.0.3 and is correct:
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($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($curl_results, true);
return isset($json[0][‘result’][‘metadata’][‘globalCounts’][‘count’])?intval( $json[0][‘result’][‘metadata’][‘globalCounts’][‘count’] ):0;

Powered by DW Question & Answer Pro