Use “Shares” for included total field label

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:

Published by Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributor 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.