How To Add Jetpack Share Social Media Buttons Above Your Posts

Sharedaddy is an excellent social sharing plugin included within the plugin modules of Jetpack.

To use the entire Jetpack plugin, you’ll need to connect to a WordPress.com account.

If you don’t want to connect to WordPress.com, you can install the Slim Jetpack plugin as an alternative to the full version.

Once you’ve chosen the buttons you want to display, they will be displayed at the bottom of your posts.

You can also add more sharing buttons to Sharedaddy which aren’t included by default.

How To Add Jetpacks Sharedaddy buttons before posts

To display them at the top of all your posts, simply add this code to your child theme’s functions.php file.

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

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

function add_sharing_buttons_before_content( $content = '' ) {
    return sharing_display() . $content;
}

They’ll then be displayed above and below all your posts and pages depending on the configuration of your settings.

It’s be proven time and time again that content above the fold gets far more attention from readers.

You would have to think that displaying your sharing buttons before your content will also improve the amount of shares you get as well.

Repositon Buttons Before or After Entry Title

This code provides another option i use at the moment here on WP Sites.

add_action( 'get_header', 'jptweak_remove_share' );
function jptweak_remove_share() {
    remove_filter( 'the_content', 'sharing_display',19 );
    remove_filter( 'the_excerpt', 'sharing_display',19 );
}
 
add_action( 'genesis_entry_header', 'reposition_jetpack', 15 );
function reposition_jetpack() {
if ( is_singular( 'post' ) && current_user_can( 'update_core' ) && function_exists( 'sharing_display' ) ) {
    sharing_display( '', true );
    }
}

This way the buttons only display for admins when logged in.

More On Customizing Jetpacks Social Buttons


Comments

3 responses to “How To Add Jetpack Share Social Media Buttons Above Your Posts”

  1. Gretchen Louise Avatar
    Gretchen Louise

    I’d like to display sharing buttons on the home page, but not on the archives pages or search results. Is there a way to customize the above code to that end? Thank you!

    1. Brad Dalton Avatar
      Brad Dalton

      Add the conditional tag after the function for the front page.

      1. Gretchen Louise Avatar
        Gretchen Louise

        This is the code I am using, and it is not displaying the share buttons on the front page:

        [code]
        //* Add Jetpack share buttons above post
        remove_filter( ‘the_content’, ‘sharing_display’, 19 );
        remove_filter( ‘the_excerpt’, ‘sharing_display’, 19 );

        add_filter( ‘the_content’, ‘sp_share_buttons_above_post’, 19 );

        function sp_share_buttons_above_post( $content = ” ) {
        if ( function_exists( ‘sharing_display’ ) ) {
        return sharing_display() . $content;
        }
        elseif ( is_front_page() ) {
        return sharing_display() . $content;
        }
        else {
        return $content;
        }
        }
        [/code]

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.