WordPress.org

China 简体中文

  • 主题
  • 插件
  • 新闻
    • 文档
    • 论坛
  • 关于
  • 获取 WordPress
获取 WordPress
WordPress.org

Plugin Directory

Minimal Share Buttons

  • 提交插件
  • 我的收藏
  • 登录
  • 提交插件
  • 我的收藏
  • 登录

该插件尚未通过WordPress的最新3个主要版本进行测试。 当与较新版本的WordPress一起使用时,可能不再受到维护或支持,并且可能会存在兼容性问题。

Minimal Share Buttons

作者:Milen Petrinski – Gonzo
下载
  • 详情
  • 评价
  • 安装
  • 开发进展
支持

描述

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

  • SVG Icons from FontAwesome, Creative Commons CC BY 4.0, MIT licence
  • Banner image by heinzremyschindler on pixbay, Creative Commons CC0
  • Plugin icon based on work by Nathan Diesel from the Noun Project, Creative Commons CC-BY

区块

该插件提供了 1 个区块.

  • Share

安装

  1. Extract the zip file and upload the folder minimal-share-buttons to the /wp-content/plugins directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress
  3. Use the Settings -> Share Options screen to select which social networks you want your content to be shared on, and on which post types the share buttons to appear.

评价

Very efficient and easy to use

clickforcharity.net 2024 年 5 月 24 日
Thanks for making something that is good but not full of silliness that seems to make thousands download it. The few who care about not leaking users’ data to data selling corporations will appreciate it as well as its low use of resources. I am surprised to see that although the few support requests of the last few years seem to have no replies yet the plugin is still being updated. Still it’s better than not updating at all.

Excelente Plugin, justo lo que necesito

Samot80 2022 年 6 月 8 日
Cansado de utilizar plugins pesados que afectan los resultados en Google. Este es perfecto aunque me gustaría que se pudiera añadir Wahtasapp para compartir

Does just what it says

Tyler Tork 2021 年 12 月 7 日
Supported social networks currently are: Native share dialog (don’t know what this does, no apparent effect in Firefox on Windows) Facebook Twitter Google Plus (why?) LinkedIn Pinterest Reddit Email There’s no control over appearance — icons are black squares with transparent cutouts. You can elect to display share buttons on all posts or none, all pages or none, all “templates” or none. There’s not an option to disable on specific pages, but you can disable for pages generally and use the “Share” block or their shortcode to insert the buttons on pages where you do want it.

Simple to use and minmalist aesthetic

thiagoalencar 2020 年 4 月 13 日
I miss share via WhatsApp.

Light and easy to use

Atanas Antonov 2019 年 11 月 22 日
Very fast, very easy to use and modify, no users tracking, no GDPR compliance needed

Light and Simple

dimal 2019 年 8 月 14 日
Light and Simple. No spying also. What is needed are some options. 1. Display or not the :Share This: and it is also huge letters 2. Show this before or after the Content of the post (now only after) 3. Some priority settings, so the Sharing doesn’t show before other plugins or after them
阅读所有8条评价

贡献者及开发者

「Minimal Share Buttons」是开源软件。 以下人员对此插件做出了贡献。

贡献者
  • Milen Petrinski – Gonzo
  • Adrian Roselli
  • colinleroy

「Minimal Share Buttons」插件已被翻译至 2 种本地化语言。 感谢所有译者为本插件所做的贡献。

帮助将「Minimal Share Buttons」翻译成简体中文。

对开发感兴趣吗?

您可以浏览代码,查看SVN仓库,或通过RSS订阅开发日志。

更新日志

1.7.3

  • Fix textdomain for native share button label.

1.7.2

  • Fix native share button label, make it translatable.

1.7.1

  • Fix typo in native share button sprintf format string, fixes the aria-label of the button.
  • Update native share button icon.

1.7.0

  • Add Mastodon (thanks @colinleroy) and Threads.
  • Update LinkedIn sharing URL.
  • Update all icons, use SVGs from FontAwesome.

1.6.2

  • Fix typo in Pinterest share URL, fixes fatal error with PHP 8.1.

1.6.1

  • Fix button tooltips in TwentyTwenty, reset word-wrap and word-break to normal.

1.6

  • Add additional class with the social network name to the buttons and allow filtering of the classes.
  • Fix native share button appearing always.
  • Fix undefined index notice when the native share option is unchecked.

1.5

  • Add native share option for devices that support the navigator.share API.

1.4

  • Define a single function to render the sharing buttons.
  • Register a shortcode for rendering the widget in classic editor.
  • Update the block editor components, used in the msb/share block.

1.3.1

  • Change default container element to div.

1.3.0

  • Don’t display the widget if no sharing options are set.
  • Display a guiding message to admins when no sharing options are set.

1.2.0

  • Refactor folder structure and apply WP coding standards.
  • Refactor JS, remove domready, load minified script, etc.

1.1.0

  • Allow sharing of all public post types.
  • Add more social networks.

1.0.1

  • Fix a fatal error in WordPress 5.0 RC.

1.0

  • Gutenberg block.
  • Code style updates, output escaping, etc.
  • Localisation updates.

0.6

  • Accessibility fix and enhancement thanks to @adrian-roselli

0.5

  • Update Twitter share URL to include permalink of page/post.
  • Add rel=”noopener” to share links, nullify window.opener in javascript.

0.4

  • Fix $this reference when registering settings page in settings.php

0.3

  • Refactor settings.php into a class.
  • Add singleton class to hold social networks list and allow manipulation through a filter.

0.2

  • Add filters that allow theme developers to use their own SVG sprite and rewrite icons.

0.1.1

  • Fix old PHP versions compatibility issue

0.1

Initial release

额外信息

  • 版本 1.7.3
  • 最后更新:1 年前
  • 活跃安装数量 100+
  • 已测试的最高版本为 6.5.5
  • PHP 版本 5.6 或更高版本
  • 语言

    Bulgarian 、 Dutch 和 English (US).

    翻译成简体中文

  • 标签
    facebookshare buttonssocial mediasocial sharingx
  • 高级视图

评级

4.5 星(最高 5 星)。
  • 4 条 5 星评价 5 星 4
  • 4 条 4 星评价 4 星 4
  • 0 条 3 星评价 3 星 0
  • 0 条 2 星评价 2 星 0
  • 0 条 1 星评价 1 星 0

添加我的评价

查看全部评论

贡献者

  • Milen Petrinski – Gonzo
  • Adrian Roselli
  • colinleroy

支持

有话要说吗?是否需要帮助?

查看支持论坛

  • 关于
  • 新闻
  • 主机
  • 隐私
  • 陈列窗
  • 主题
  • 插件
  • 区块样板
  • 学习
  • 支持
  • 开发者
  • WordPress.tv ↗︎
  • 参与
  • 活动
  • 捐赠 ↗
  • 未来五分计划
  • WordPress.com ↗
  • Matt ↗
  • bbPress ↗
  • BuddyPress ↗
WordPress.org
WordPress.org

China 简体中文

  • 关注我们的 X(原 Twitter)账号
  • Visit our Bluesky account
  • Visit our Mastodon account
  • Visit our Threads account
  • 访问我们的 Facebook 公共主页
  • 关注我们的 Instagram 账号
  • 关注我们的 LinkedIn 主页
  • Visit our TikTok account
  • 访问我们的 YouTube 频道
  • Visit our Tumblr account
代码如诗