Skip to content
This repository has been archived by the owner on Dec 17, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
imjakechapman committed Mar 24, 2014
2 parents 23d85b0 + 5654ed6 commit 8b76bbb
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,35 @@ Simple Social Button Plugin for keeping templates clear of random script tags an
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 call your buttons anywhere you want

{{ SocialBtn('facebook') }}
{{ SocialBtn('twitter') }}
{{ SocialBtn('google') }}
Now display your buttons

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

Or for all the 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.

{{ SocialBtns() }}
{{ 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. (exclude script coming soon.)
You can also specify a script for only one button.

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

And call that button

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


## TODO
1. Accept pipe delimited list of scripts to load {{ SocialShareScripts('facebook|twitter') }}
2. Accept a script/s to exclude {{ SocialShareScripts('not google|facebook') }} for when other buttons are added
3. Accept a button/s to exclude {{ SocialBtns('not facebook|twitter') }} for when other buttons are added
4. Accept an array of parameters for when calling a specific button {{ SocialBtn('facebook', ["width" => "125", "url" => "http://example.com"]) }}
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.

0 comments on commit 8b76bbb

Please sign in to comment.