Wp Social Login and Register Social Counter Shortcodes

Below, you’ll find a detailed guide on how to add the Wp Social Login and Register Social Counter Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Wp Social Login and Register Social Counter Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Wp Social Login and Register Social Counter Plugin and the shortcodes it provides:

Plugin Icon
Wp Social Login and Register Social Counter

"Wp Social Login and Register Social Counter is a user-friendly WordPress plugin that enables seamless social media login and registration. It also keeps track of your social interactions, making social networking management easier."

★★★★☆ (49) Active Installs: 20000+ Tested with: 6.3.2 PHP Version: 7.4
Included Shortcodes:
  • [xs_social_login]
  • [xs_social_counter]
  • [xs_social_share]

Wp Social Login and Register Social Counter [xs_social_login] Shortcode

The ‘xs_social_login’ shortcode from the WP-Social plugin allows users to login via various social media platforms. It accepts parameters like provider, button text, class, and style. The ‘provider’ parameter specifies the social media platform. If left empty or set to ‘all’, it enables all platforms. The ‘btn-text’ is the login button’s text, while ‘class’ and ‘style’ define the button’s appearance.

Shortcode: [xs_social_login]

Parameters

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

  • provider – defines the social login provider, ‘all’ for all providers
  • btn-text – sets the text to be displayed on the button
  • class – allows to add a custom CSS class to the button
  • style – enables adding inline CSS styles to the button

Examples and Usage

Basic example – The shortcode displays the social login widget with all available providers.

[xs_social_login /]

Advanced examples

Display the social login widget with only Facebook and Twitter as providers. It also customizes the button text and applies a custom CSS class and style.

[xs_social_login provider="facebook,twitter" btn-text="Log in with" class="my-custom-class" style="color:red;" /]

Here, the shortcode displays the social login widget with Google as the only provider and customizes the button text.

[xs_social_login provider="google" btn-text="Sign in with Google" /]

In this example, the shortcode displays the social login widget with LinkedIn as the provider and applies a custom CSS class.

[xs_social_login provider="linkedin" class="linkedin-login" /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'xs_social_login', 'xs_create_dynamic_shortcode' );

Shortcode PHP function:

function xs_create_dynamic_shortcode($atts, $content = null) {
		$atts = shortcode_atts(
			array(
				'provider' => 'all',
				'btn-text' => $content,
				'class'    => '',
				'style'    => '',
			), $atts, 'xs_social_login'
		);

		$str = empty($atts['provider']) ? 'all' : str_replace(' ', '', $atts['provider']);

		$providers = explode(',', $str);

		return xs_social_login_shortcode_widget($providers, $atts['btn-text'], 'show', $atts['class'], $atts['style']);
	}

Code file location:

wp-social/wp-social/inc/admin-create-shortcode.php

Wp Social Login and Register Social Counter [xs_social_counter] Shortcode

The WP-Social plugin shortcode ‘xs_social_counter’ displays social media counters. It accepts options for ‘provider’, ‘class’, ‘style’, and ‘hover’. This shortcode allows customization of the social counter’s appearance and the specific social media platforms displayed.

Shortcode: [xs_social_counter]

Parameters

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

  • provider – Specifies the social media platform(s) to display.
  • class – Adds a custom CSS class to the shortcode output.
  • style – Applies a specific style to the social counter.
  • hover – Defines a hover effect for the social counter.

Examples and Usage

Basic example – A simple usage of the shortcode to display the social counter for all providers.

[xs_social_counter /]

Advanced examples

Displaying the social counter for specific providers, in this case, Facebook and Twitter.

[xs_social_counter provider="facebook,twitter" /]

Adding a custom class to the social counter. This can be used for custom styling in your CSS.

[xs_social_counter class="my-custom-class" /]

Changing the style of the social counter. The style parameter allows you to select a predefined style from the plugin.

[xs_social_counter style="style-2" /]

Adding a hover effect to the social counter. The hover parameter can be used to add a predefined hover effect from the plugin.

[xs_social_counter hover="hover-2" /]

Combining multiple parameters. This example shows a social counter for Facebook and Twitter, with a custom class, style, and hover effect.

[xs_social_counter provider="facebook,twitter" class="my-custom-class" style="style-2" hover="hover-2" /]

PHP Function Code

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

Shortcode line:

add_shortcode('xs_social_counter', [$this, 'social_counter_shortcode']);

Shortcode PHP function:

function social_counter_shortcode($atts, $content = null) {

		$atts = shortcode_atts(
			[
				'provider' => 'all',
				'class'    => '',
				'style'    => '',
				'hover'    => '',
			],
			$atts,
			'xs_social_counter'
		);

		if(isset($atts['provider']) && $atts['provider'] != 'all') {
			$provider = explode(',', $atts['provider']);
		} else {
			$provider = 'all';
		}

		$config = [];
		$config['class'] = trim($atts['class']);
		$config['style'] = trim($atts['style']);
		$config['hover'] = trim($atts['hover']);

		return $this->get_counter_data($provider, $config);
	}

Code file location:

wp-social/wp-social/inc/counter.php

Wp Social Login and Register Social Counter [xs_social_share] Shortcode

The WP-Social plugin shortcode, ‘xs_social_share’, allows users to customize social share buttons. It accepts parameters like ‘provider’ (to specify social media platforms), ‘class’, ‘style’, ‘hover’, ‘layout’ (for button arrangement), ‘count’ (to display share count), and ‘box_only’. This shortcode generates share buttons according to the provided configurations.

Shortcode: [xs_social_share]

Parameters

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

  • provider – Chooses the social media platform for sharing
  • class – Specifies the CSS class of the share button
  • style – Determines the visual style of the share button
  • hover – Configures the hover effect of the share button
  • layout – Sets the orientation of the share button
  • count – Decides whether to show the share count or not
  • box_only – Defines if only a box is displayed without any content

Examples and Usage

Basic example – The shortcode below is a basic usage of the wp-social plugin. It will display all the social share buttons with a default style and layout.

[xs_social_share]

Advanced examples

Below is an example of the shortcode used to display only specific social share buttons. The ‘provider’ attribute is used to specify the social media platforms to be included. In this case, it will display buttons for Facebook and Twitter.

[xs_social_share provider="facebook,twitter"]

Another advanced usage of the shortcode is to customize the appearance of the social share buttons. The ‘class’ attribute is used to add a custom CSS class, ‘style’ attribute to add inline CSS styles, ‘layout’ to specify the layout orientation, and ‘count’ to show or hide the share count. In the example below, it will display all social share buttons with a custom class ‘my-social-buttons’, in a vertical layout, with a custom style and without showing the share count.

[xs_social_share class="my-social-buttons" style="background-color: blue; color: white;" layout="vertical" count="No"]

PHP Function Code

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

Shortcode line:

add_shortcode('xs_social_share', [$this, 'social_share_shortcode']);

Shortcode PHP function:

function social_share_shortcode($atts, $content = null) {

		$atts = shortcode_atts(
			array(
				'provider' => 'all',
				'class'    => '',
				'style'    => '',
				'hover'    => '',
				'layout'   => 'horizontal',
				'count'    => 'No',
				'box_only' => '',
			),
			$atts,
			'xs_social_share'
		);

		if(empty(trim($atts['provider'])) || $atts['provider'] == 'all') {
			$provider = 'all';
		} else {
			$provider = explode(',', strtolower($atts['provider']));
		}

		$config = [];
		$config['class'] = trim($atts['class']);
		$config['style'] = trim($atts['style']);
		$config['hover'] = trim($atts['hover']);
		$config['hv_effect'] = trim($atts['layout']);
		$config['show_count'] = ucfirst(strtolower(trim($atts['count'])));
		$config['show_count'] = in_array($config['show_count'], ['Yes', 'No']) ? $config['show_count'] : 'No';
		$config['conf_type'] = 'shortCode';

		return $this->get_share_data($provider, $config);
	}

Code file location:

wp-social/wp-social/inc/share.php

Conclusion

Now that you’ve learned how to embed the Wp Social Login and Register Social Counter Plugin shortcodes, 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 *