Social Media Share Buttons Shortcode

Below, you’ll find a detailed guide on how to add the 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 Social Media Share Buttons Plugin shortcode not to show or not to work correctly.

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

Plugin Icon
Social Media Share Buttons

"Social Media Share Buttons is a versatile WordPress plugin that allows you to add and customize share buttons for different social media platforms, boosting your site's engagement."

★★★★☆ (60) Active Installs: 3000+ Tested with: 5.0.20 PHP Version: false
Included Shortcodes:
  • [sgmb]

Social Media Share Buttons [sgmb] Shortcode

The Social Media Builder (SGMB) shortcode is a versatile tool that allows you to display your social media widgets. It utilizes the ‘sgmb’ shortcode to initiate the SgmbWidget class, which contains your social media widget settings.

Shortcode: [sgmb]

Parameters

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

Based on the provided code, it appears that the shortcode does not take any specific parameters. The function ‘showShortCode’ only accepts a general $args argument, which can be any array of arguments. However, the function does not specify what these arguments should be, nor does it use them in any way. Instead, it simply creates a new instance of the ‘SgmbWidget’ class and calls its ‘init’ method, passing the $args array to it.

Therefore, without additional information about what parameters the ‘init’ method of the ‘SgmbWidget’ class accepts and how it uses them, it’s impossible to provide a list of specific parameters for this shortcode.

Thus, the response is:

NO_PARAMS

Examples and Usage

Basic example – A simple way to use the shortcode is to just call it without any parameters, like so:

[sgmb]

Advanced examples

Now, let’s look at more advanced usage of the shortcode. You can pass various parameters to customize the output. The parameters are passed in a key=value format, separated by spaces. Here are some examples:

1. Displaying a specific social media button:

[sgmb id="facebook"]

In this example, we’re specifying the id parameter to display the Facebook button.

2. Displaying multiple social media buttons:

[sgmb id="facebook,twitter,linkedin"]

Here, we’re passing multiple ids separated by commas to display Facebook, Twitter, and LinkedIn buttons.

3. Displaying a social media button with a custom title:

[sgmb id="facebook" title="Follow us on Facebook!"]

In this example, we’re using the title parameter to customize the text displayed on the Facebook button.

Please note that the actual parameters and their values might vary depending on the configuration of the SgmbWidget class and the social media builder plugin.

PHP Function Code

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

Shortcode line:

add_shortcode('sgmb', array($this, 'showShortCode'));

Shortcode PHP function:

function showShortCode($args)
	{
		$widget = new SgmbWidget();
		return $widget->init($args);
	}

Code file location:

social-media-builder/social-media-builder/classes/SGMB.php

Conclusion

Now that you’ve learned how to embed the 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 *