Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active July 18, 2018 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/ce745133b0409f3352e89d2fec73915f to your computer and use it in GitHub Desktop.
Save billerickson/ce745133b0409f3352e89d2fec73915f to your computer and use it in GitHub Desktop.
<?php
/**
* Dont display low share counts
*
* @author Bill Erickson
* @see https://www.billerickson.net/code/shared-counts-remove-low
*
* @param array $link
* @param int $id
* @param string $style
* @return array $link
*/
function be_shared_counts_remove_low( $link, $id, $style ) {
if( 'included_total' !== $link['type'] )
return $link;
$minimum_share_count = 100;
$count = shared_counts()->core->count( $id, 'included_total', $echo = false, $round = false );
if( $count < $minimum_share_count )
$link['count'] = 0;
return $link;
}
add_filter( 'shared_counts_link', 'be_shared_counts_remove_low', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment