How do I add Twitter button to a post in genesis theme



How do I add Twitter button to a post in genesis child theme.

There are many WordPress plugins can be found and downloaded for free in order to share our blog post or to have Twitter button in our single post.

But since I am using Genesis Framework, I can just install some plugin that I really need and it’s too hard or takes too long time to write the code.

Here is how do I add the twitter button in a single post.

Open the function.php.
Add the following code to the it

/** Add Tweet Button on single posts **/
add_filter('the_content', 'tweet_button');
function tweet_button( $content ) {
    if ( is_page() )
        return $content;
    return '<a href="http://twitter.com/share" class="twitter-share-button" data-url="'. get_permalink() .'" data-count="vertical" data-via="bali_web">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>' . $content;
}

change the data-via="bali-web" to your twitter username.

.twitter-share-button {
    float: left;
    margin: 0 10px 10px 0;
}

I will then have the Twitter button as the screenshot below.

how do I add twitter button into a single post in Genesis child theme

how do I add twitter button into a single post in Genesis child theme

Try it your self and let me know the outcome!

Hire me for your online business solution

Smart Bali Website

I'm a lucky husband and happy father with a cute daughter who work at home as frelance webmaster, I love to build amazing websites and help client succeed. Weather you have small, medium even large project, I am always interested to work with you.

Contact me today and let's boost your online business