EA Share Count – Change button location based on share count

This is in use on my blog. Posts with 10 or less shares only display share buttons at the bottom, encouraging readers to share. Posts with more than 10 shares also have the buttons at the top, for social proof.

* Change button location based on share count
* @author Bill Erickson
* @link http://www.billerickson.net/code/easc-location-based-on-share-count
* @param array $locations
* @return array $locations
function be_easc_location( $locations ) {
$total = ea_share()->core->count( false, 'included_total' );
if( 10 > $total ) {
$locations['before']['hook'] = false;
$locations['before']['filter'] = false;
return $locations;
add_filter( 'ea_share_count_theme_locations', 'be_easc_location' );
view raw functions.php hosted with ❤ by GitHub

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk