Dmitrij Schmidt
asked 10 years ago

Notice: Undefined index: result in /home/XXX/public_html/wp-content/themes/dw-focus_1.0.7_theme/functions.php on line 1105

2 Answers
Dmitrij Schmidt
answered 10 years ago

sorry, I accidentally pressed “enter”, and there’s no way to edit the post…. it would be nice if admin could fix this report 🙂
there’s and error related to “sharing” sidebar:

Notice: Undefined index: result in /home/XXX/public_html/wp-content/themes/dw-focus_1.0.7_theme/functions.php on line 1105

whole function goes like this:

 // retrieves JSON with HTTP POST method for current URL $json_string = wp_remote_post("", $args); if (is_wp_error($json_string)){ // return zero if response is error return "0"; } else { $json = json_decode class="prettyprint"($json_string['body'], true); // return count of Google +1 for requsted URL // if( isset($json['result']) ) return intval( $json['result']['metadata']['globalCounts']['count']); } }

after reading THIS topic I have changed line 1105 from

return intval( $json['result']['metadata']['globalCounts']['count']); 


return isset( $json['result']['metadata']['globalCounts']['count']); 

this partially removed that error.
still – nothing is displayed in Google+ likes counter (as shown on the screenshot below)
sidebar screenshot
is there any way to fix it?

answered 10 years ago

To resolve this issue please follow my instruction here:
1. Open functions.php file in /wp-content/themes/dw-focus/functions.php
2. Replace following code from line 412 to line 417 

$twitter_count = dw_get_twitter_count( $url );
// //Twitter
// $twitter_count = dw_get_twitter_count( $url );
$facebook_count = dw_get_facebook_count( $url );
$linkedin_count = dw_get_linkedin_count( $url );
$gplus_count = dw_get_plusones_share_count( $url );


$twitter_count = dw_get_twitter_count( get_permalink() );
$facebook_count = dw_get_facebook_count( $url );
$linkedin_count = dw_get_linkedin_count( get_permalink() );
$gplus_count = dw_get_plusones_share_count( get_permalink() );

3. Replace following code from line 1104 to line 1105

// if( isset($json['result']) )
return intval( $json['result']['metadata']['globalCounts']['count'] );


return intval( $json['result']['metadata']['globalCounts']['count'] );

Hope this helps!

Dmitrij Schmidt
replied 10 years ago

works like a charm! thank You a lot!
it seems to be the reason to start learning PHP… 🙂

Powered by DW Question & Answer Pro