Simply add the following code to your functions.php file.
[php]// Modify Post Info
add_filter('genesis_post_info', 'my_post_info_filter');
function my_post_info_filter($post_info) {
if (!is_page()) {
$post_info = '[ post_date] By [ post_author_posts_link] [ post_comments] | Share: <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="TWITTER_USERNAME">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> '; //remove spaces after initial [
//$post_info = 'Custom text'; //edit this to whatever you'd like.
}
return $post_info;
}[/php]
Paul says
This isn’t working for me. I’ve copied and pasted it into my functions.php file and still nothing.
Nick says
Oh thanks! I was looking for days about how to do this… Found it here finally by googling ‘post info tweet button’ after seeing that Christopher of Genesis Tutorials had it in the Visual Hook Guide.
There is an error in this code though… The end of it… </script>
With this code I think I’ll be fine to add more social buttons next to post info as well…
Nick says
I’ve fixed the code and gotten it working on my site.
Now I’d like to know how to get the button to be aligned over to the right, rather than butted up next to the post info text. I’ve tried float: right on all the Twitter button classes/ids but it just messes it up rather than doing the job of moving it across to the right edge.
Here is the fixed version:
// Modify Post Info
add_filter(‘genesis_post_info’, ‘my_post_info_filter’);
function my_post_info_filter($post_info) {
if (!is_page()) {
$post_info = ‘[post_date] by [post_author_posts_link] [post_comments] | Share: Tweet‘; //remove spaces after initial [
//$post_info = ‘Custom text’; //edit this to whatever you’d like.
}
return $post_info;
}
Blogging Tips says
Not working for me !! and can I add facebook like button too ?
Travis Smith says
Please check http://twitter.com/about/resources/buttons for the most recent and up-to-date Twitter code to use.
Thanks,
Travis