2017 © Pedro Peláez
 

library wp-share-buttons

A library for WordPress theme that adds social share buttons.

image

inc2734/wp-share-buttons

A library for WordPress theme that adds social share buttons.

  • Friday, July 27, 2018
  • by inc2734
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,293 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 27 Versions
  • 23 % Grown

The README.md

WP Share Buttons

CI Latest Stable Version License, (*1)

This library adds share button shortcodes for WordPress. This buttons display to sum http and https counts. And, It works lightly with asynchronous display and caching., (*2)

When SNS Count Cache plugin is activated WP Share Buttons uses that counts., (*3)

This buttons can use for singular pages., (*4)

Install

$ composer require inc2734/wp-share-buttons

How to use

<?php
new \Inc2734\WP_Share_Buttons\Bootstrap();

Shortcodes

All buttons

[wp_share_buttons type="(Optional)" title="(Optional)" post_id="(Required)"]

type:
Baloon, horizontal, icon, block, official
When type is not official, buttons sums http and https counts.

Facebook

[wp_share_buttons_facebook type="(Optional)" post_id="(Required)"]

Need App Token to get facebook share count., (*5)

/**
 * @see https://developers.facebook.com/tools/accesstoken
 */
add_filter(
  'inc2734_wp_share_buttons_facebook_app_token',
  function() {
    return 'Your App Token';
  }
);

Twitter

[wp_share_buttons_twitter type="(Optional)" title="(Optional)" post_id="(Required)"]

X

[wp_share_buttons_x type="(Optional)" title="(Optional)" post_id="(Required)"]

Hatna Bookmark

[wp_share_buttons_hatena type="(Optional)" post_id="(Required)"]

Feedly

[wp_share_buttons_feedly type="(Optional)" post_id="(Required)"]

Pocket

[wp_share_buttons_pocket type="(Optional)" title="(Optional)" post_id="(Required)"]

Pinterest

[wp_share_buttons_pinterest type="(Optional)" post_id="(Required)"]

Line

[wp_share_buttons_line type="(Optional)" post_id="(Required)"]

Feed

[wp_share_buttons_feed type="(Optional)" post_id="(Required)"]

Copy URL

[wp_share_buttons_copy type="(Optional)" title="(Optional)" post_id="(Required)"]

Filter hooks

inc2734_wp_share_buttons_count_cache_seconds

/**
 * Set count cache time
 *
 * @param  {int} $seconds
 * @return {int}
 */
add_filter(
    'inc2734_wp_share_buttons_count_cache_seconds',
    function( $seconds ) {
        return 300;
    }
);

inc2734_wp_share_buttons_apply_https_total_count

/**
 * When permalink is https, whether or not to sum http and https
 *
 * @param  {bool} $bool
 * @return {bool}
 */
add_filter(
    'inc2734_wp_share_buttons_apply_https_total_count',
    function( $bool ) {
        return true;
    }
);

inc2734_wp_share_buttons_localize_script_handle

/**
 * Set handle of localize_script
 *
 * @param  {string} $handle
 * @return {string}
 */
add_filter(
    'inc2734_wp_share_buttons_localize_script_handle',
    function( $handle ) {
        return $handle;
    }
);

inc2734_wp_share_buttons_facebook_official_button_share

/**
 * Add facebook sahre button when using official facebook like button
 *
 * @param  {boolean} $boolean
 * @return {boolean}
 */
add_filter(
    'inc2734_wp_share_buttons_facebook_official_button_share',
    function( $boolean ) {
        return $boolean;
    }
);

inc2734_wp_share_buttons_shared_title

/**
 * Customize shared title
 *
 * @param  {string} $title
 * @param  {string} $service twitter or copy
 * @return {string}
 */
add_filter(
    'inc2734_wp_share_buttons_shared_title',
    function( $title, $service ) {
        if ( 'twitter' === $service ) {
            return $title . ' #hashtag';
        }
        return $title;
    },
    10,
    2
);

inc2734_wp_share_buttons_shared_hashtags

/**
 * Customize shared title
 *
 * @param  {string} $title
 * @param  {string} $service twitter or copy
 * @return {string}
 */
add_filter(
    'inc2734_wp_share_buttons_shared_hashtags',
    function( $hashtags, $service ) {
        if ( 'twitter' === $service ) {
            return 'hashtagA,hashtagB';
        }
        return $title;
    },
    10,
    2
);

inc2734_wp_share_buttons_count_cache_seconds

/**
 * Customize share count caching time
 *
 * @param $seconds
 * @return $seconds
 */
add_filter(
    'inc2734_wp_share_buttons_count_cache_seconds',
    function( $seconds ) {
        return $seconds;
    },
    10
);

inc2734_wp_share_buttons_facebook_app_token

/**
 * Set Facebook app token.
 *
 * @param string|false
 * @return string|false
 */
add_filter(
    'inc2734_wp_share_buttons_facebook_app_token',
    function( $token ) {
        return $token;
    },
    10
);

The Versions

22/07 2018

2.0.1

2.0.1.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

22/07 2018

2.0.0

2.0.0.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

19/07 2018

1.1.0

1.1.0.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

16/03 2018

1.0.6

1.0.6.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

04/03 2018

1.0.5

1.0.5.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

04/03 2018

1.0.4

1.0.4.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

25/01 2018

1.0.3

1.0.3.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

10/01 2018

1.0.2

1.0.2.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

10/01 2018

1.0.0

1.0.0.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

28/12 2017

0.6.0

0.6.0.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

18/11 2017

0.5.9

0.5.9.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

17/11 2017

0.5.8

0.5.8.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

17/11 2017

0.5.7

0.5.7.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

14/11 2017

0.5.6

0.5.6.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

07/11 2017

0.5.5

0.5.5.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

06/11 2017

0.5.4

0.5.4.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

30/09 2017

0.5.3

0.5.3.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

27/09 2017

0.5.2

0.5.2.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

23/08 2017

0.5.1

0.5.1.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

28/07 2017

0.5.0

0.5.0.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

23/07 2017

0.4.2

0.4.2.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

23/07 2017

0.4.1

0.4.1.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

21/07 2017

0.4.0

0.4.0.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

17/07 2017

0.3.0

0.3.0.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

16/07 2017

0.2.0

0.2.0.0

A library for WordPress theme that adds social share buttons.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires