添加计数器到Twitter和google plus等社交媒体

时间:2012-04-14 18:22:24

标签: javascript twitter google-plus social-media

我不太熟悉Twitter和Google Plus的API。有人能解决我的问题吗?我想在我的Twitter,Google Plus和Stumble Upon按钮上添加一个计数器。这将集成在我的wordpress帖子和页面中。我认为已经实现了facebook按钮。我唯一剩下的问题是Twitter,Google Plus和Stumble Upon(可选)。

谢谢!

<!-- 
Facebook
/////////////////
--> 
    <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

    <a href="http://www.facebook.com/sharer.php?u=<?php echo urlencode(get_permalink()); ?>&t=<?php echo urlencode(get_the_title()); ?>"  name="fb_share" type="box_count" target="_blank" id="facebook">
    Share
</a>


<!-- 
Twitter
/////////////////
--> 

<a href="http://twitter.com/share?url=<?php echo urlencode(get_permalink()); ?>&text=<?php echo urlencode(get_the_title()); ?>" class="twitter-share-button" id='twitter' target="_blank">
    Tweet
</a>


<!-- 
Google Plus
/////////////////
--> 

<a href="https://m.google.com/app/plus/x/?v=compose&content=<?php echo urlencode(get_permalink()) . " " . urlencode(get_the_title()); ?>" id='gplus' target="_blank">
    Google Plus
</a>


<!-- 
Stumble Upon
/////////////////
--> 

<a href="http://www.stumbleupon.com/submit?url=<?php echo urlencode(get_permalink()); ?>" target="_blank" id='stumble'>
    Stumble
</a>

3 个答案:

答案 0 :(得分:1)

答案 1 :(得分:0)

 <div class="addthis_toolbox addthis_floating_style addthis_counter_style"    style="left:50px;top:160px;">
 <a class="addthis_button_facebook_like" fb:like:layout="box_count"></a>
 <a class="addthis_button_tweet" tw:count="vertical"></a>
 <a class="addthis_button_google_plusone" g:plusone:size="tall"></a>
 <a class="addthis_counter"></a>
 </div>
 <script type="text/javascript">var addthis_config = {"data_track_addressbar":true}; </script>
 <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5178354276acf324"></script>

答案 2 :(得分:0)

您可以使用jQuery获取计数器......

对于Facebook Pinterest和Twitter https://gist.github.com/andrefrd/9520512

,我有一个要点