When using the “Included Total” field with the Icons style, the output looks something like this:
With the following code, you can change it to “Shares” for multiple shares, or “Share” if there’s only one share, like this:
This code snippet goes in a core functionality plugin or Code Snippets.
/**
* Shared Counts - Change "Total" to "Shares"
* @author Bill Erickson
* @see https://sharedcountsplugin.com/2019/03/27/use-shares-for-included-total-field-label/
*/
function ea_shared_counts_change_total_label( $link ) {
if( 'included_total' == $link['type'] ) {
$link['label'] = _n( 'Share', 'Shares', $link['count'] );
}
return $link;
}
add_filter( 'shared_counts_link', 'ea_shared_counts_change_total_label' );
Code language: PHP (php)
Filters used:
shared_counts_link