tombrucke / otomaties-share-buttons
此包的最新版本(1.2.0)没有可用的许可证信息。
1.2.0
2024-09-25 20:16 UTC
Requires
- composer/installers: ^1.0 || ^2.0
- dev-master
- 1.2.0
- 1.1.0
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-snyk-fix-dc46b88d9fc6645a93cb48eb08c9b7ed
- dev-snyk-fix-e5664b795adc4cb9d4e59db2939c2c27
- dev-snyk-fix-9f8248f3c8674b7e999bbd17674d881f
- dev-snyk-fix-8c0d7ebabd008c122e208be56ae3c4e1
- dev-snyk-fix-67891c27d90b0f394c0713739c16bf03
- dev-snyk-upgrade-91098799d50e6e4f53acf5853eafef68
This package is auto-updated.
Last update: 2024-09-25 20:16:58 UTC
README
要求
安装
composer require tombroucke/otomaties-share-buttons
& 激活插件
配置
https://example.com/wp-admin/options-general.php?page=otomaties-share-buttons
自定义
过滤器
otomaties_share_buttons_string_copied_link // String to display in alert otomaties_share_buttons_string_copy_link_error // String to display in alert otomaties_share_buttons_container_class // Buttons container class otomaties_share_buttons_button_class // Button class otomaties_share_buttons_button_icon // Button icon, 2nd parameter is type (e.g. facebook) otomaties_share_buttons_button // Button output, 2nd parameter is type (e.g. facebook) otomaties_share_buttons_output // HTML output
复制链接按钮
您可以在分享按钮设置中取消勾选“在复制链接后显示警告”,并显示自定义通知。(例如:Bootstrap 4 Toast)
add_filter('otomaties_share_buttons_output', function ($output) { ob_start(); ?> <div class="toast bg-success toast--copied hide" role="alert" aria-live="assertive" aria-atomic="true"> <div class="toast-header bg-success"> <strong class="toast-title text-white mr-auto"></strong> <button type="button" class="ml-2 mb-1 close text-white" data-dismiss="toast" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="toast-body text-white"> </div> </div> <?php return $output . ob_get_clean(); });
window.addEventListener('otomaties_share_button_copied', function(e){ if(e.detail.copied) { $('.toast-title','.toast--copied').html('<i class="fa fa-check"></i> ' + sage_vars.strings.copied.title) $('.toast-body','.toast--copied').html(sage_vars.strings.copied.body) } else { $('.toast-title','.toast--copied').html('<i class="fa fa-times"></i> ' + sage_vars.strings.not_copied.title) $('.toast-body','.toast--copied').html(sage_vars.strings.not_copied.body) } $('.toast--copied').toast('show') }); $('.toast--copied').toast({ delay: 8000, });