1. Home
  2. Docs
  3. Attesa PRO
  4. Show social share buttons

Show social share buttons

NB: Sharing buttons are available only with Attesa PRO plugin.

This option allows you to show sharing buttons on your pages, posts and custom post types. You can also choose which buttons to show and where on the page.

To activate the sharing buttons, go to your WordPress Dashboard under “Appearance-> Customize-> Attesa Theme Options-> Sharing Buttons” and activate the option called “Use Sharing Buttons“.

From this panel you can choose where to show the sharing buttons (pages, posts and custom post type), choose where to show the buttons (before, after or both in the content), choose the sharing buttons, choose the style and the text next to the buttons.

Hide/Show sharing buttons individually

You can also decide to hide/show the sharing buttons individually on single post/page/custom post type.
To do this, create or edit the page, go under the content and find the “Attesa Extra Theme Options” box. Go under the “General Settings” tab, activate the general settings and you’ll find the option “Show social sharing buttons“. Here you can decide to use the default theme options or choose to hide or show them for the page in question.

How to add new sharing buttons using child theme

Need to add new social sharing buttons? You can do it very easily using the child theme.
This PHP filter will allow you to add new social sharing buttons to your website, here is an example:

add_filter('attesapro_social_sharing_register', 'attesapro_additional_share_buttons_example', 999, 3);
function attesapro_additional_share_buttons_example($data, $url, $title) {
	$newData = array (
		'instagram' => array(
			'name' => esc_html__('Instagram', 'attesa-pro'), //Name of the social network
			'id' => 'instagram', //ID of the social network
			'href' => 'https://instagram.com/share/?url='. $url .'&title=' .$title, //Dynamic URL and Title to share the page on the social network
			'icon' => 'fa fa-instagram', //FontAwesome icon
		),
	);
	return array_merge($data, $newData);
}

NB: In this code example I used Instagram, but it’s just a non-working example since Instagram doesn’t allow (yet) to share posts.

In the array you will need to add the name of the social buttons, the unique ID, the dynamic address for sharing and the icon to be shown.

In the code, use $url to print the URL of the page to share, and $title to print the title of the page.

When the code is complete, paste it into the “functions.php” file of your child theme, the new icon will be visible in the theme options and ready to be shown on your website.