Show total share count for “included total” field

The “Included Total” field in Shared Counts displays the sum total of counts across all the other buttons you’re displaying. It does not use the “total” value you see when editing a post. For instance, if you don’t include a Pinterest button on your site, it won’t include your Pinterest pins in the count total.

The code below changes the “Included Total” field to show the total across all services, regardless of whether you’re including a button. This is best used if you are only showing the total count ( you have “Count Total Only” checked in Settings > Shared Counts).

This code snippet goes in a core functionality plugin or Code Snippets.

 * Show total share count for included total
 * @author Bill Erickson
 * @see
 * @param array $link
 * @param int $id
 * @param string $style
 * @return array $link
function be_shared_counts_total( $link, $id, $style ) {
	if( 'included_total' == $link['type'] ) {
		$link['count'] = shared_counts()->core->count( $id, 'total' );
	return $link;
add_filter( 'shared_counts_link', 'be_shared_counts_total', 5, 3 );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.