Shared Counts Buttons Shortcode

Below, you’ll find a detailed guide on how to add the Shared Counts – Social Media Share Buttons Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Shared Counts – Social Media Share Buttons Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Shared Counts – Social Media Share Buttons Plugin and the shortcodes it provides:

Plugin Icon
Shared Counts – Social Media Share Buttons

"Shared Counts – Social Media Share Buttons is a WordPress plugin designed to enhance your site's social sharing. It allows users to easily share your content on various social media platforms, increasing engagement and visibility."

★★★★☆ (26) Active Installs: 10000+ Tested with: 6.1.4 PHP Version: 5.6
Included Shortcodes:
  • [shared_counts]

Shared Counts Buttons [shared_counts] Shortcode

The Shared Counts shortcode is a versatile tool that enables users to display social share counts on their website. This shortcode accepts parameters like ‘location’, ‘style’, and ‘services’. These parameters allow users to customize the placement, appearance, and specific social platforms for the share counts. However, the shortcode prevents display in feeds to maintain optimal aesthetics.

Shortcode: [shared_counts]

Parameters

Here is a list of all possible shared_counts shortcode parameters and attributes:

  • location – defines the placement of the shared counts
  • style – sets the visual appearance of the shared counts
  • services – specifies the social media platforms for sharing

Examples and Usage

Basic example – A simple usage of the shortcode to display shared counts at a specific location.

[shared_counts location="footer" /]

Advanced examples

Using the shortcode to display shared counts at a specific location with a particular style. The style parameter allows you to customize the look and feel of the shared counts display.

[shared_counts location="header" style="modern" /]

Using the shortcode to display shared counts for specific services. The services parameter allows you to specify which social sharing services’ counts you want to display.

[shared_counts location="header" style="modern" services="facebook,twitter" /]

Using the shortcode to display shared counts at a specific location, with a specific style and for specific services. This is a more advanced usage of the shortcode, allowing for greater customization of the shared counts display.

[shared_counts location="sidebar" style="classic" services="linkedin,pinterest" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [shared_counts] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'shared_counts', [ $this, 'shortcode' ] );

Shortcode PHP function:

function shortcode( $atts = [] ) {

		$atts = shortcode_atts(
			[
				'location' => 'shortcode',
				'style'    => false,
				'services' => '',
			],
			$atts,
			'shared_counts'
		);

		// Don't show or include the share badges in the feed, since they won't
		// display well.
		if ( ! is_feed() ) {
			return $this->display( esc_attr( $atts['location'] ), false, esc_attr( $atts['style'] ), get_the_ID(), $atts['services'] );
		}
	}

Code file location:

shared-counts/shared-counts/includes/class-shared-counts-front.php

Conclusion

Now that you’ve learned how to embed the Shared Counts – Social Media Share Buttons Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *