A lean plugin that leverages SharedCount.com API to quickly retrieve, cache, and display various social sharing counts.
PHP CSS JavaScript

README.md

EA Share Count

Release License

Contributors: jaredatch, billerickson
Tags: facebook, linkedin, pinterest, share, share buttons, social, stumbleupon, twitter
Requires at least: 4.1
Tested up to: 4.7.0
Stable tag: 1.8.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

EA Share Count is a lean plugin for quickly retrieving, caching, and displaying various social sharing counts and buttons. It's developer-friendly and very extensible.

Installation

Download the plugin here. Once installed, go to Settings > Share Count to customize.

Use the "Retrieve Share Counts From" checkboxes to select which APIs you'd like to query for share counts. By default it will not receive any share counts. The Facebook API requires you to provide an Access Token.

The "Share Buttons to Display" field lets you control which share buttons to display and in what order. They can be automatically added before and/or after your site's content by selecting a Theme Location. Alternatively you can use ea_share()->from->display() in your theme to display the buttons.

Screenshots

1. Settings Page.

Settings Page

2. Fancy Style (default)

Fancy Style

3. Slim Style

Slim Style

4. Bubble Style

Bubble Style

5. Email Popup

Email Popup

Customization

You can also use the ea_share() function to access any of the internal methods. The most common use will be to get a specific share count. See all options here.

  • ea_share()->core->count( get_the_ID(), 'facebook' ); Provides the number of facebook likes/shares/comments
  • ea_share()->core->count( get_the_ID(), 'included_total' ); Provides the total count from all the services specified in settings
  • ea_share()->front->display( $location, $echo ); Display the share buttons, as configured in Settings > Share Count. The $location is an identifying class added to wrapping HTML (useful if you have buttons in multiple locations). $echo is a boolean value indicating whether the buttons should be echoed or returned.

There are also many filters in place to customize the plugin. Here are some code snippets.

  • ea_share_count_display Customize what is displayed in the share count area.
  • ea_share_count_display_wrap_format Customize the wrapping class and format of share count area.
  • ea_share_count_theme_locations Specify which hooks/filters are used for the "Before Content" and "After Content" share buttons. See the code for more information.
  • ea_share_count_link An array of elements used to form the share link. See the code for more information.
  • ea_share_count_link_url The URL being shared
  • ea_share_count_default_image Default image used by Pinterest for generic URLs.
  • ea_share_count_single_image Image used by Pinterest for singular content (post, page...). Set to Featured Image by default.
  • ea_share_count_site_url What URL is used if you specify 'site' as the ID. Defaults to home_url().
  • ea_share_count_single The share count used when the requested service isn't recognized. If you're adding custom services, you'll use this to set the share count for that service.
  • ea_share_count_total Customize what is used as the 'total_count'
  • ea_share_count_load_css Disable the CSS from loading, like this. Note that the icons are part of the CSS, so you'll need to include your own icon font.
  • ea_share_count_load_js Disable the JavaScript from loading.
  • ea_share_count_email_modal Enable email modal window in use cases where the share button is manually being called.
  • ea_share_count_email_labels Email modal window labels for different fields. See the code for more information.
  • ea_share_count_email_subject Subject used in email modal. Defaults to "Your friend $from_name has shared an article with you"
  • ea_share_count_email_body Body of email used in email modal. Defaults to Post Title and Post Permalink.
  • ea_share_count_email_headers Email headers used by email modal. See the code for more information.
  • ea_share_count_update_increments How frequently the share counts are updated. See the code for default increments.
  • ea_share_count_api_params Customize the global API parameters (currently only contains URL). Example
  • ea_share_count_admin_services What services are available on the settings page
  • ea_share_count_query_services What services are available to be queried for share counts
  • ea_share_count_options The options used on the settings page