Title: Grouped Counter
Last modified: August 21, 2016

---

# Grouped Counter

 *  [Krissy](https://wordpress.org/support/users/krissy/)
 * (@krissy)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/grouped-counter/)
 * Is there any way to utilize this plugin so that there is a grouped counter? IE:
   20 shares on FB, 30 on Twitter shows an output of “50 Shares” to the side of 
   the script?
 * [http://wordpress.org/plugins/simple-share-buttons-adder/](http://wordpress.org/plugins/simple-share-buttons-adder/)

Viewing 1 replies (of 1 total)

 *  [tvanhemert](https://wordpress.org/support/users/tvanhemert/)
 * (@tvanhemert)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/grouped-counter/#post-4448054)
 * I customized my installation to do this. If you’re comfortable editing code here’s
   the functions I’ve added to my installation in the file simple-share-buttons-
   adder.php.
 *     ```
       function ssba_totals($urlCurrentPage) {
           return "<span class='ssba_sharecount' id='totalShareCount'>".getTotalShareCount($urlCurrentPage)."</span>";
       }
   
       function getTotalShareCount($urlCurrentPage) {
           $totalShareCount = 0;
           $shareCountString = 0;
           $totalShareCount+= getFacebookShareCount($urlCurrentPage);
           $totalShareCount+= getTwitterShareCount($urlCurrentPage);
           $totalShareCount+= getPinterestShareCount($urlCurrentPage);
           $totalShareCount+= getGoogleShareCount($urlCurrentPage);
           $totalShareCount+= getStumbleUponShareCount($urlCurrentPage);
           $totalShareCount+= getRedditShareCount($urlCurrentPage);
           $totalShareCount+= getLinkedinShareCount($urlCurrentPage);
   
           if($totalShareCount < 1000) $shareCountString = $totalShareCount;
           if($totalShareCount >= 1000) $shareCountString = ($totalShareCount / 1000)."K";
           if($totalShareCount >= 1000000) $shareCountString = ($totalShareCount / 1000000)."M";
           return $shareCountString." Shares";
       }
       ```
   
 * Then add this line of code:
    `$htmlShareButtons.= ssba_totals($urlCurrentPage);`
 * just before $htmlShareButtons.= ‘</div>’; In my installation this was on line
   686
 * It also abbreviates numbers over 1,000. for example 1,100 would show as 1.1K 
   shares and 1,200,000 would show as 1.2M Shares.
 * You’ll need to manually style the share count to fit your theme, but if you’ve
   made it this far I’m sure you can handle it.
 * Maybe the plugin author can implement this in a future release.

Viewing 1 replies (of 1 total)

The topic ‘Grouped Counter’ is closed to new replies.

 * ![](https://ps.w.org/simple-share-buttons-adder/assets/icon-256x256.png?rev=2661516)
 * [Simple Share Buttons Adder](https://wordpress.org/plugins/simple-share-buttons-adder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-share-buttons-adder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-share-buttons-adder/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-share-buttons-adder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-share-buttons-adder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-share-buttons-adder/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [tvanhemert](https://wordpress.org/support/users/tvanhemert/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/grouped-counter/#post-4448054)
 * Status: not resolved