Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active August 15, 2016 17:13
Show Gist options
  • Save billerickson/e60b4d05f1da50b0e689bced628a6fc3 to your computer and use it in GitHub Desktop.
Save billerickson/e60b4d05f1da50b0e689bced628a6fc3 to your computer and use it in GitHub Desktop.
<?php
/**
* Test Share Counts
*
*/
function ea_test_share_counts() {
// Only run on dev site
if( ! ea_is_dev_site() )
return;
// Get share counts for homepage
// - From SharedCount
$url = ea_production_url( home_url() );
$api_key = '3b23f65ff74add9ee362b46642a1c866ede9238f';
$api_domain = 'http://free.sharedcount.com';
$api_query = add_query_arg( array(
'url' => $url,
'apikey' => $api_key,
), 'http://free.sharedcount.com/url' );
$results = wp_remote_get( $api_query );
ea_pp( 'SharedCount' );
ea_pp( json_decode( $results['body'] ) );
// -- Direct from Facebook
$counts = ea_share()->core->counts( 'site', true, true );
ea_pp( 'Direct from Facebook' );
ea_pp( $counts );
}
add_action( 'genesis_before', 'ea_test_share_counts' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment