Minimal Share Buttons

Minimal Share Buttons Install Statistics

-11
0%
Today: 0 Yesterday: 11 All-time: 3,537 downloads
Minimal Share Buttons Icon

Try plugin: Minimal Share Buttons

We'll create fresh WordPress site with Minimal Share Buttons installed. You have 20 minutes to test the plugin after that site we'll be deleted.

Takes ~10 seconds to install.

About Minimal Share Buttons

A social share plugin that doesn't spy on users and doesn't slow down your site.

3


4


0


0


0

updated: 7 months ago
since: 7 years ago

Description

Add simple share buttons under your posts, add share block in the new editor, or use the widget to add sharing to any widget area your theme provides. This plugin uses simple SVG icons for social network logos and small vanilla JavaScript to allow the user to share the current post or page. Share icons inherit their colours from the theme link colours to match the website design.

Why choose Minimal Share Buttons before other similar plugins?

  • Minimal and elegant look that blends with your theme (tested with all latest default WordPress themes as well as with some other popular themes).
  • Minimal impact on your site’s performance – the plugin loads only a small SVG file with the icons, less than 1k CSS and 3.5ะบ unminified and uncompressed JavaScript – most of it to make SVG icons work in old browsers.
  • Doesn’t spy on your users – the plugin doesn’t load any thitd-party scripts that record your user’s activity on your site, doesn’t set or read any cookies.
  • Sharing through the native share dialog on devices that support it.
  • GDPR-hasle-free – since the plugin doesn’t leak personal information to third parties, this makes it easier for website owners to comply with the European privacy regulations.
  • Accessibility – the share links have labels, read by screen readers, and visible for keyboard users.
  • Gutenberg and WordPress 5.0 ready – the plugin provides block that displays the share buttons so that authors can place them wherever they want in the post content.

Usage

There are five ways of displaying the share buttons on a post or page:

  1. Force them to display under the content of the post by checking the relevant checkboxes in the Display settings sections on the plugin settings screen.
  2. Add Share widget to the sidebar or another widget area.
  3. Use the Gutenberg block to add the share buttons whereever you want in the post content.
  4. Use the shortcode [msb_share title="Share this"] in the classic editor.
  5. Use the function msb_display_buttons() to render the widget in your theme templates.

Theme developers

From version 1.4 you can more easily display the sharing widget in your templates using the function msb_display_buttons(). The function accepts two arguments – an array of options, passed to the widget, and a second boolean argument that tells the function to echo the resulting markup. Here’s an example:

$args = [
  'before_widget' => '<div class="msb-container">',
  'after_widget'  => '</div>',
  'before_title'  => '<h2>',
  'after_title'   => '</h2>',
  'title'         => __( 'Share this article', 'mytextdomain' ),
];
msb_display_buttons( $args, true );

If your theme uses SVG icons, combined into a SVG sprite, and your sprite has icons for Facebook, Twitter, Google+ and LinkedIn, there are two filters you can use to replace the icons, provided by the plugin, with yours. The results of the two filters are concatenated with a hash between them and passed through esc_url before output.

Another filter allows manipulation of the array of social networks.

msb_sprite_url

The filter is applied to the URL of the sprite image and the filter function should return the URL (without the hash sign) of an SVG sprite image, consisting of icons in symbol elements.

msb_icon_name

The filter is applied to the icon name before concatenating it to the sprite URL. It should return the ID of the icon symbol in the sprite.

msb_socials

The filter is applied to the default list of social networks and allows adding or removing socials networks. The array of social networks is associative array, the key is used for the option name on settings page and for the icon ID, and the value is associative array with three elements – field_label (the label of the field in settings), button_label (the label of the button for screenreader users), and share_url (the URL for sharing links). The share_url is passed through sprintf with two params – the URL of the current page and the title of the page. Example:

function my_add_xing( $socials ){

  $socials['xing'] = array(
    'field_label' => __( 'Xing', 'mytheme' ),
    'button_label' => __( 'Share on Xing', 'mytheme' ),
    'share_url' => 'https://www.xing.com/spi/shares/new?url=%1$s&title=%2$s'
  );

  return $socials;

}
add_filter( 'msb_socials', 'my_add_xing' );<h3>msb_button_classes</h3>

This filter allows changing the classes of the individual buttons. Two parameters are apssed to the filter functions: the array with classes and the social network / button slug.

Credits