Facebook Share Button

Categories

Component ID

1712852

Component name

Facebook Share Button

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Recently, Facebook has decided to deprecate the Facebook Share button, which has been used by a wide variety of sites that I work on to help push content to Facebook for purposes of increasing traffic. The Facebook Like button has taken its place, but it does not perform as well as the preferred Facebook Share for viral purposes.

In order to circumvent this issue, this module was created to take the place of the deprecated button, and in its place, provide some easily added code in order to add the Facebook Share button back your site, in the following formats...

  • Box Count
  • Horizontal Display
  • Plain Button Display

Also, in order to increase site performance, the counts are stored in a database table to prevent constant contact with the Facebook API, which will reduce site load time, and performs the normal functionality of incrementing the count when clicked.

Also, if the button is clicked, the database will be updated to pull the count on next page load to insure more accurate up to date counts.

Recently added was the ability to choose which Count to display. But default, the Facebook Share count is used, but you can use any of the following counts returned by the Facebook API

  • Share Count
  • Like Count
  • Comment Count
  • Total Count
  • Click Count

These options are all selectable from the Admin Settings Page which is found at...

admin/settings/facebook-share

Currently, this module is dependent on the usage of jQuery and Javascript to work. If necessary, will work on the ability to add the button without the use of javascript

In order to add the button to the site, just make use of the following code

$output = facebook_share_create_share_button();

This will provide the facebook share button to the current url, and remove any query strings appended to the end of the url.

If you have a page where you wish to have multiple share buttons, you may add a share button for a particular url using the following code

$path = 'some/url'; //any url on your site
$output = facebook_share_create_share_button($path);

This method will allow you to easily add in multiple facebook shares to an aggregated blog page, in order to allow for distinct functionality