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.
<?php | |
/** | |
* 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' ); |