Skip to content
Simple Social Button Plugin for CraftCMS
Branch: master
Clone or download
Jake Chapman
Latest commit 88e164e May 27, 2014
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
craftysocialshare Updated user inputted options to work correctly. May 27, 2014
LICENSE Initial commit Mar 9, 2014
README.md Updated Readme.md Mar 9, 2014

README.md

CraftySocialShare

Simple Social Button Plugin for keeping templates clear of random script tags and social button markup everywhere.

Usage

In order for the buttons to work, you need to load the social buttons scripts. Best place would be just above the closing body tag.

{{ SocialShareScripts() }}
You can specify scripts by using pipe delimiting list
{{ SocialShareScripts('facebook|google') }}

Now display your buttons

{{ SocialBtns() }} // This will display the default for all buttons

Sometimes we want more control over the outputted button attributes. The template tag accepts an array of parameters that can be passed to a specific button. For a list of parameters check out the developer guide for each individual button type. If a parameter is not passed it will fallback to the buttons default value.

{{ SocialBtn('facebook', {"width": "150px", "action": "like", 'layout': "box_count", "faces": 'true', "share": 'false'}) }}
{{ SocialBtn('twitter', {"size": "small", "via": "imjakechapman", "text": "checkout CraftySocialShare for CraftCMS", "count": "vertical", "lang": "en", "counturl": "http://twitter.com", "related": "craftcms:The Ultimate CMS by Pixel&Tonic", "hashtags": "craftcms", "opt-out": "false"}) }}
{{ SocialBtn('google', {"href": "https://github.com/imjakechapman/CraftySocialShare", "size": "tall", "annotation": "bubble", "align": "left", "expandTo": "top", "recommendations": "true", "count": "true"}) }}

You can also specify a script for only one button.

// Load only the facebook script 
{{ SocialShareScripts('facebook') }}

And call that button

{{ SocialBtn('facebook') }} // default
{{ SocialBtn('facebook', {"width": "150px", "action": "like", 'layout': "box_count", "faces": 'true', "share": 'false'}) }} // with opt parameters passed through

TODO

  1. Refactor where needed.
  2. Add more button options.
  3. Add option to wrap each button in an element and give it an optional class name for better styling control.
You can’t perform that action at this time.