require('../wp-blog-header.php');
query_posts('&showposts=-1&order=ASC');
while (have_posts()) : the_post();
$url = the_permalink();
$json = file_get_contents( 'https://graph.facebook.com/fql?q=SELECT%20like_count,%20total_count,%20share_count,%20click_count,%20comment_count%20FROM%20link_stat%20WHERE%20url%20=%20%27' . $url . '%27' );
$json_data = json_decode($json, false);
echo $json_data->data[0]->total_count;
echo '<br>';
endwhile;
The above code, rather than returning the total share count, it returns the posts URLs.
How can I make it return the total_count value for each post ? I suspect line 6 needs to return URLs first before next line does the task..
Regards,
Thanks!
Someone in the WordPress Development network pointed me to this:
the_permalink();
doesn’t return the permalink, it prints it, so I should useget_the_permalink();
instead: