Use different button styles before and after content

In Settings > Shared Counts you can select a button style and whether they appear above and/or below the post content.

But what if you want to use different button styles in those locations? You can use the shared_counts_theme_locations filter to customize the settings for each location. Let’s say you want to use the “Classic” style at the top of the post and the “Icon” style at the bottom.

In Settings > Shared Counts, set the buttons to display “Before and After Content”, and set the style to “Classic”. Then add the following code to change the “After Content” style to “Icon”.

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

/**
 * Shared Counts, After Content Style
 * @author Bill Erickson 
 * @see https://sharedcountsplugin.com/2019/03/27/use-different-button-styles-before-and-after-content/
 */
function be_shared_counts_after_content_style( $locations ) {
	$locations['after']['style'] = 'icon';
	return $locations;
}
add_filter( 'shared_counts_theme_locations', 'be_shared_counts_after_content_style' );
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.