Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

There are several plugins that insert buttons to retweet and like into a post. You can see the count of retweets and likes at the top of single blog posts.

What I want to do is show the retweets and likes in the blog home page, which has excerpts and thumbnails

Like this

Fabuous Post Title Retweet (button) - 45 18 likes

[excerpt]

There must be a way to edit functions.php for this but I don't know what to do.

How is this done?

THanks

Examples of desired display: http://epiclaunch.com/ http://wptricks.net/

share|improve this question

3 Answers 3

Here is a short and simple plugin I wrote to add a re-tweet and Facebook like button to each post. This version of the Facebook like button uses the newer XFBML instead of the iframes but requires you to register an app id.

To use the buttons just add the function call to your loop.

<?php
/*
Plugin Name: C3M Social Share Buttons
Plugin URI: http://c3mdigital.com/
Description: Adds Facebook and Twitter Share Buttons using template tags
Version: 1.0
Author: Chris Olbekson
Author URI: http://c3mdigital.com
*/

// Social Share Buttons by Chris Olbekson.  This Plugin is Licensed under The GPL v2 and my be freely distributed.  This plugin will not work without entering a valid Facebook app id registered to the domain it is being used on.

//This adds the Facebook and Twitter js to your foooter hooking into wp_footer
function c3m_share_this_scripts() {

        echo '<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>';
        echo '<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>';
        echo  '<div id="fb-root"></div>';
        echo    '               <script>';
        echo        "               window.fbAsyncInit = function() {;
                        FB.init({appId: 'xxxxxxxxxxxxxxx', status: true, cookie: true,
                                xfbml: true});
                                };";
        echo        "                 (function() {
                                    var e = document.createElement('script'); e.async = true;
                                    e.src = document.location.protocol +
                                      '//connect.facebook.net/en_US/all.js';
                                    document.getElementById('fb-root').appendChild(e);
                                  }());
                                </script>";   


                    }

    add_action('wp_footer', 'c3m_share_this_scripts' );


    function c3m_social_share() {

                echo '<div class="social-share" style="margin-bottom:50px;width:500px;">
                    <ul class="share-buttons">
<li style="float:left;margin-right:25px;"><a href="http://twitter.com/share" class="twitter-share-button" data-url="'; echo the_permalink(); echo '" data-text="'; echo the_title(); echo '" data-count="horizontal" data-via="your_twitter_username">Tweet</a></li>
                    <li style="float:left;width:300px"><fb:like href="'; echo the_permalink(); echo'" layout="standard" action="like" font="lucida grande"></fb:like></li>';


                echo '</ul>
                     </div><div class="clear"> </div>'; 

                    }


?>
share|improve this answer

While you could edit your theme, it seems that Wptricks.net is using the WP Socializer plugin.

http://wordpress.org/extend/plugins/wp-socializer/

share|improve this answer

I realize this is an old question, but I wanted to point out wptricks.net's retweet button is actually from the Tweetmeme plugin, not the Socializer plugin.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.