Shared Counts – Change label for total field

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:

/**
 * Shared Counts - Change "Total" to "Shares"
 * @author Bill Erickson
 * @link https://www.billerickson.net/code/shared-counts-change-label-for-total-field
 */
function ea_shared_counts_change_total_label( $link ) {
	$classes = explode( ' ', $link[ 'class' ] );
	if( 'included_total' == $link[ 'type' ] && in_array( 'style-icon', $classes ) ) {
		$link[ 'label' ] = _n( 'Share', 'Shares', $link[ 'count' ] );
	}
	return $link;
}
add_filter( 'shared_counts_link', 'ea_shared_counts_change_total_label' );

Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

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

Let's Talk