Move Shared Counts to a different hook or filter

The below code changes the “Before” theme location to use my ea_post_intro hook.

You can also provide a filter, to which the buttons will be prepended (for “before” hook) or append (for “after” hook). You can also specify a different button style to use. Ex: $locations['before']['style'] = 'block';

For more information, see the source code.

<?php
/**
* Move Shared Counts
* @see https://www.billerickson.net/code/shared-counts-theme-location/
*
* @param array $locations
* @return array
*/
function ea_shared_counts_location( $locations ) {
$locations['before']['hook'] = 'ea_post_intro';
return $locations;
}
add_filter( 'shared_counts_theme_locations', 'ea_shared_counts_location' );
view raw functions.php hosted with ❤ by GitHub

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