Add Jetpack Sharing Buttons Above Post Content

How to Add Jetpack Sharing Buttons Above Post Content

in Social Media
Google+ LinkedIn

If you are self hosting WordPress on your server then you are missing out tons of features available specifically to wordpress.com users. To narrow this gap down, WordPress team has developed Jetpack plugin for self hosted blogs so they can also take benefits of these features without hosting their website on wordpress.com’s restrictive environment. Since Jetpack solves tons of problems in one single plugin and packs with many great features to supercharge your website, it is one of the most popular plugin in WordPress plugin respiratory. Today we will discuss Share Buttons feature in Jetpack.

The Jetpack sharing buttons in the plugin are the easiest way to share content and connect with social networking websites. By default WordPress adds the Jetpack sharing buttons to the bottom of your post content. This could be an issue for some who want to display Jetpack sharing buttons above post content. But the problem is that the plugin does not provide any option or straight forward way to change the default location of sharing buttons. Following is a simple solution for you, if you want to move these Jetpack sharing buttons above post content and post title.

If you would like to display the Jetpack sharing buttons at the top and bottom of your entry content, just paste this code snippet into your theme’s functions.php file.

// add jetpack share buttons above post content
function wcs_move_jetpack_share_buttons_above_content( $content = '' ) {
    if ( function_exists( 'sharing_display' ) ) {
        return sharing_display() . $content;
    } else {
        return $content;
    }
}

remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );

add_filter( 'the_content', 'wcs_move_jetpack_share_buttons_above_content', 19 );
add_filter( 'the_excerpt', 'wcs_move_jetpack_share_buttons_above_content', 19 );

source

Share the love

If you like this snippet, share it with others!

12 Replies on "Add Jetpack Sharing Buttons Above Post Content"

  1. Marie

    Worked like a charm! Thank you

    1. Marie, glad you found it helpful. Looking forward to hearing much more from you.

      1. Maitreya Dwaipayan

        Where exactly to add?

      2. You should paste this code snippet into your theme’s functions.php file.
        It’s written there.

  2. Ataul Ghani

    Nice tutorial, loved it! thanks! :)

    1. Thanks Ataul,

      I’m glad you found it useful :)

  3. Adam

    Thanks You :)

  4. Stacey

    How to I have the sharing buttons only above the post?

  5. Jason

    Terrific! Is there a way to remove the share buttons from appearing at the bottom?

  6. noonecares

    Make sure you don’t add anything else than the code to theme functions.php because it can make your site go blank when there is an error.

  7. Seyi

    Thanks a lot for this. Very helpful, very easy. God bless.

    1. Seyi, I am glad you found it helpful. :)

Leave a Reply

Your email address will not be published. Required fields are marked *