BallTribe offers webmasters and digital publishers the chance to feature our sharing button around the web. This encourages voting and sharing links between a large audience who may submit content into BallTribe. Our badges are very simple to implement, you just need to include a few lines of code into your CMS template and then the badge will show up on all your pages.
Below we have outlined both styles for you in an easy-to-install manner. The normal style voting badge measures at 65×66 as almost a perfect square. This will fit nicely into any blog sidebar, header, or post article voting section. Similarly our compact badge only takes up dimensions of 86×19 which makes this perfect as a small vote bar.
Adding The Code
Note you only need to add this once if you are running on a CMS which includes a template system (such as wordpress). However if you are running static HTML pages you’ll need to go and add this into the heading on each page, or at least the pages where you expect to run a voting badge.
If you’re looking to run the regular (larger) sized voting badge you’ll need to use the code below and add it to your CMS template file for all posts (index.php, or single.php, etc.) if you want the badge to show on all posts or just use the code on the post itself for individual posts. I have included two separate instances of the code. First is a simplified version which only requires the story URL and an optional title. This would work best if you just need to get a button working but don’t need extra submission data, such as tags. Replace where it says YOUR URL with your actual page address and YOUR TITLE with your page title. Note that you can leave the title field blank, or delete it altogether, and the button will still work fine.
<a target="_blank" class="BTButton BTLarge" href="YOUR URL" title="YOUR TITLE"></a>
But if you are running WordPress I highly suggest picking up the 2nd code block. This includes PHP calls to functions which will fill in the data you need automatically. Whereas in the first block you’ll need to manually edit the href value to your own URL, or use built-in functions off another CMS.
<a target="_blank" class="BTButton BTLarge" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="<?php $posttags = wp_get_post_terms( get_the_ID() , 'post_tag' , 'fields=names' ); echo implode( ', ' , $posttags ); ?>"></a>
The code here is actually very similar, just changing the class “BTLarge” into “BTSmall”. The two blocks below again contain options for a basic include and WordPress include. You’ll also need to edit the first block with your page URL as before. But the WordPress code will dynamically pull all your post data.
<a target="_blank" class="BTButton BTSmall" href="YOUR URL" title="YOUR TITLE"></a>
<a target="_blank" class="BTButton BTSmall" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="<?php $posttags = wp_get_post_terms( get_the_ID() , 'post_tag' , 'fields=names' ); echo implode( ', ' , $posttags ); ?>"></a>