sharebar_button function for facebook showing 3.7M
-
I noticed when including the inline code in a theme template file that the facebook like count was 3.7M. When viewing the source I saw the [url] token wasn’t replaced with the post url.
This is the code that have to be inserted in your template file as instructed on the plugin page to display the share button.
sharebar_button('facebook','small');
The problem:
function sharebar_button($name, $size = 'big'){ global $wpdb; $item = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."sharebar WHERE name='$name'")); if($size == 'big') echo stripslashes($item->big); else echo stripslashes($item->small); }
The solution:
function custom_sharebar_button($name, $size = 'big'){ global $wpdb; $item = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."sharebar WHERE name='$name'")); if($size == 'big') echo stripslashes(sharebar_filter($item->big)); else echo stripslashes(sharebar_filter($item->small)); }
Add this code to your functions.php file and call the custom_sharebar_button function instead in your template files where needed, this is to keep your changes in case the plugin gets updated:
Example:
custom_sharebar_button('facebook','small');
The sharebar_filter function need to be applied to the $item->small and $item->big properties.
If this sounds right, could you please add this fix to one of your next plugin updates.
Thanks for the nice plugin, really easy to use.
- The topic ‘sharebar_button function for facebook showing 3.7M’ is closed to new replies.