Share on Facebook

Someone sent me a comment about my Add To Facebook plugin asking for it to work a little differently. They were asking for the page to be added to Facebook as a link instead of in the Mini-Feed. I am happy to oblige with the Share on Facebook plugin.

This plugin adds a link to the bottom of each post and page on your blog with the text “Share on Facebook”, Facebook icon, both or the Facebook share button depending on what you choose on the Options page. Alternately, you can add the link anywhere within your theme using a template tag.

This plugin has been tested on WordPress 3.1.3 and should work on previous WordPress versions as well. Now compatible with PHP 4.x. (PHP 5.x is no longer a requirement.)

Installation Instructions

  1. Add a directory called ‘share-on-facebook’ (without the quotes) to your ‘/wp-content/plugins/’ directory.
  2. Upload shareonfacebook.php to ‘/wp-content/plugins/share-on-facebook/’ directory.
  3. Activate the plugin through the ‘Plugins’ page in WordPress.
  4. Go to ‘Settings->Share on Facebook’ in your admin interface to select your options.

There are three options on the options page: Link Type, Insertion Type and Page Type.

Once this option is set a link will appear after the content of each post/page with the text “Share on Facebook”, the Facebook icon, both or the familiar Facebook share button. Clicking the link will bring the user to the Facebook site to add the link to their profile. If the user isn’t logged in they will be prompted to do so.

Download Current Version
Share on Facebook 1.7

* v1.7 – Fixed the “You do not have sufficient permissions to access this page.” message some users were getting when saving options.
* v1.6 – Added comment tags around JavaScript to address errors.
– Changed a $_SERVER[‘PHP_SELF’] call to $_SERVER[‘REQUEST_URI’] to address possible security issue.
* v1.5 – Added compatibility with PHP 4.x.
* v1.4 – Added option to choose to have the Facebook link appear on Posts, Pages or both (Posts and Pages).
* v1.3 – Facebook’s “Post to Profile” page now appears in a popup for all posts on the index page of a blog. Previously this would work only for the first post on the index pages with the rest of the posts opening the “Post to Profile” page in the same window (instead of the popup).
* v1.2 – Reworked with valid XHTML.
– Integrated redundant code.
– Updated styles for the button.
* v1.1 – Fixed bug in template tag implementation.
* v1.0 – Initial public release.

If you have any questions, comment or suggestions please leave them in a comment or email them to me.

Download Old Versions
Share on Facebook 1.6
Share on Facebook 1.5
Share on Facebook 1.4
Share on Facebook 1.3
Share on Facebook 1.2
Share on Facebook 1.1
Share on Facebook 1.0

If you find this plugin useful please feel free to donate a little money to help me offset the costs of this website. Thanks.