Books, movies, reviewage and other mixy things

Warning: Creating default object from empty value in /home4/jessicabo/public_html/otherwhereco/wp-content/plugins/wordpress-code-snippet/wcs.php on line 332

Warning: Creating default object from empty value in /home4/jessicabo/public_html/otherwhereco/wp-content/plugins/wordpress-code-snippet/wcs.php on line 332

There are very few downsides to having a self hosted WordPress site. Actually, there are none. You may think you are missing out on some of the great features the WordPress.com sites offer, when in reality Jetpack gives you all of that functionality, for free and it just works… for the most part.

Go download Jetpack, seriously. If the only thing you use is the WordPress stats or Subscribers feature it makes the whole thing worth it. Use it for it’s advanced distribution, sharing services, spell check or gravatar features and you pretty much have a pile of awesome.

Out of the box Jetpack works very well, however for those who have custom themes, especially full of custom excerpts, post types and content, things can get a little wonky. Especially with Sharedaddy, the sharing plug-in bundled with Jetpack. If you just turn it on, chances are you will end up with two (or in my case a billion) instances of the sharing plugins cluttering up your page. It’s like social networking acne and it ain’t pretty. You have to do a few tiny tweaks to make it appear correctly.

For whatever weird ass reason, they didn’t add a php hook so you can put it in your template where you need it. But no fear! It is still totally possible and easy as shite.

Get your hack on: The Sharedaddy plug-in works by calculating the excerpt and content length then adding the buttons afterwards. For most people who only use either the content or the excerpt or use standard themes, this is just fine. For everyone else this is a cluster, so we need to remove the filters that add the instance of the Sharedaddy plug-in.

The file that needs to be edited can be found at wp-content/plugins/jetpack/modules/sharedaddy/sharing-service.php

Save that piece than all that’s left is to add the hook in your template and inside the loop, where you want the buttons to appear.

Rock on! Properly place sharing buttons, accomplished. Sweet.

NOTE:Beware of updates. If Jetpack updates its plug-in and Sharedaddy gets updated with it, you will have to redo the hack in the share-services.php fie.

Questions? Comments? Undiluted praise? Throw it in below, I love to hear what you have to say.


  1. Geraldine says:

    This tip works! I’m using Twitter Bootstrap and I have a custom page template. My problem, Sharedaddy displays on that page. Solution: remove those two lines.

  2. Towfiq says:

    Isn’t it wise to add this to your functions.php instead of editing the plugin files?

    if ( function_exists( ‘sharing_display’ ) ) remove_filter( ‘the_excerpt’, ‘sharing_display’, 19 );
    if ( function_exists( ‘sharing_display’ ) ) remove_filter( ‘the_content’, ‘sharing_display’, 19 );

    since with the update of the plugin, the change will be lost.

    • Dominic says:

      Thanks a lot Towfiq! Works like a charm!

    • Jan smith says:

      Hi, Towfiq,
      I cannot get your solution to work; probably not putting it into the right function.php file?

      When I remove those two lines (which you wisely warned not to do) the buttons disappear as they should. But when I add the “remove_filter” code you have, they remain.

      What I’d really like to know also is: how can I get the “Print” button in this plugin to use my css and to only include the post content, not the entire page with header, content, footer, sidebar, etc.

      Any suggestions for that?


      • Towfiq says:

        you could also try adding this:
        if ( function_exists( ‘sharing_display’ ) ) { remove_filter( ‘the_excerpt’, ‘sharing_display’, 19 );}
        if ( function_exists( ‘sharing_display’ ) ) { remove_filter( ‘the_content’, ‘sharing_display’, 19 );}

        and about the print.css issue, I think you should contact the jetpack developers.

        • Jan smith says:

          Thanks for that suggestion, BUT…

          Perhaps I am putting it in the wrong place.

          I’m using a theme called Thesis, which has a “functions.php” and a “custom-functions.php”. The latter is supposed to be used for things such as this, where we want to modify the normal action.

          I put your code into both of those places, with no result.

          Is this code supposed to go into a file in the plugin? Exactly where should I put it?


          • Towfiq says:

            it would be better if you ask the thesis guys about this. Because I have no idea why its not working for you.

          • Dexter Adams says:

            Delete the single quotes in Towfiq’s response and retype them. You’ll notice that when you do the code works. The single quotes here are rich text and not recognized by PHP.

    • Jessi says:

      Yep, definitely adding it to the functions.php file is the safest way to go. Good call.

  3. Gianfranco says:

    /* Sharing Display */

    THIS CODE Where is pasted? In which file?

    • Jessi says:

      The /* Sharing Display */ code goes where you want the sharing buttons to actually display in your theme files. For example in your single.php within your loop.

  4. Janmejai says:

    Not working for me,tried but whenever i add the social sharing in the loop it just disabled my sidebar and removed the comment section from the site,tried thrice.

  5. For those who are not able to get this working, try this:

    /* Remove sharing buttons from their default locations */
    remove_filter( ‘the_content’, ‘sharing_display’, 19 );
    remove_filter( ‘the_excerpt’, ‘sharing_display’, 19 );

    Works like a charm.
    I simply got rid of the “if” conditions.

  6. marius says:

    this works:

    /** Custom positioning of Jetpack buttons */

    // Remove the ‘the_content’ filter callback added by sharedaddy
    // to prevent the sharing links from being appended to the posts content.

    add_action( ‘init’, ‘custom_init’, 11 );
    function custom_init(){

    // if sharing_display() function does not exist, return
    if( ! function_exists( ‘sharing_display’ ) )

    // remove the callback sharing_display() for the ‘the_content’ filter.
    remove_filter( ‘the_content’, ‘sharing_display’, 19 );



  7. Alex says:

    Thanks, this tutorial works for me!

Leave a Reply

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