Facebook has always remained relatively open with regard to the access it provides to their (or your) data - either by way of a registered API call or an open graph request. This article will show you how to include the Facebook share count (via unregistered graph access) into a WordPress post or page, or into a PHP application, in plain text.
Note: This hack has reached its end of life. Always use the Facebook API when able. Details here. Article remains for information purposes only.
For the example, we'll reference the article on Internoetics where the code was first published. The shortcode of
[fbcount url="http://www.internoetic ... inkedin-googleplus/"] (snipped ) returns a count of N/A.
Copy and paste the WordPress function into your theme's
functions.php file or, if you sensibly have one installed, your custom functions plugin. You may optionally download and install our plugin from the bottom of of the page.
urlof the page you're querying for a count. If left blank the current page will be used.
Used outside of WordPress the following function may be used. Usage requires Simple Cache.
- The returned JSON data includes other information that may be of use (including the last update time). The title, description, and other data are sourced from your Object Graph tags. The array below is the response returned for our example URL.
No longer available.