-
-
Save billerickson/ce745133b0409f3352e89d2fec73915f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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