定制 tombroucke/otomaties-share-buttons 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tombroucke/otomaties-share-buttons

最新稳定版本:1.2.3

Composer 安装命令:

composer require tombroucke/otomaties-share-buttons

包简介

README 文档

README

Requirements

Font Awesome

Installation

composer require tombroucke/otomaties-share-buttons & activate plugin

Configuration

https://example.com/wp-admin/options-general.php?page=otomaties-share-buttons

Customization

Filters

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

Copy link button

You could uncheck 'Display alert after copying link' in the Share buttons settings, and display a custom notification. (Example: 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">&times;</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,
});

统计信息

  • 总下载量: 1.41k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2021-12-08