• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2784

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Consultation
  • Full Access
  • Log in

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

  • Center Sharedaddy Social Sharing Buttons in WordPress
  • Style Jetpacks Social Sharing Buttons
  • How To Add New Sharing Service URL’s to Jetpacks Social Sharedaddy Plugin

Jetpack

Reader Interactions

Comments

  1. Gretchen Louise says

    February 12, 2014 at 6:04 pm

    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!

    Log in to Reply
    • Brad Dalton says

      February 12, 2014 at 6:09 pm

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

      Log in to Reply
      • Gretchen Louise says

        February 12, 2014 at 6:30 pm

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

        //* 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;
        	}
        }
        Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.