Jetpack

Moving Sharing Icons

One of the most common requests you send us is “Can we move the Sharing and Like buttons?” By default, the Sharing and Like buttons get printed at the end of the the_content() Loop function, which causes them to display at the end of your post’s text — but that may not be where you want them in your site’s design.

There are actually two ways to move the Sharing buttons and one for the Like button.

Move the Sharing and Like buttons

Jetpack, by default, just attaches this tag to two filters — the_content() and the_excerpt() — so that the Sharing icons get displayed. By editing your theme files, you can move the tag wherever you’d like — we default to attaching it to the filters so that, when the Sharing and Likes modules are activated, the buttons are displayed with no extra work. You’re free to move it around to put the Sharing icons where you’d like; here’s how:

1. In your functions.php file, add the following:

function jptweak_remove_share() {
    remove_filter( 'the_content', 'sharing_display',19 );
    remove_filter( 'the_excerpt', 'sharing_display',19 );
    if ( class_exists( 'Jetpack_Likes' ) ) {
        remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
    }
}

add_action( 'loop_start', 'jptweak_remove_share' );

2. Find the file for the location where you’d like the sharing icons to appear and insert the following code in the area you want the Sharing or Likes buttons to appear:

if ( function_exists( 'sharing_display' ) ) {
    sharing_display( '', true );
}

if ( class_exists( 'Jetpack_Likes' ) ) {
    $custom_likes = new Jetpack_Likes;
    echo $custom_likes->post_likes( '' );
}

Note that you do not need to display these together; you can put sharing_display() in a separate place from the Likes display codeblock.

Move the Sharing Buttons via jQuery

This method comes via Beau Lebens, a fellow Automattician. He coded this jQuery method for moving the Sharing icons:

jQuery( document ).ready( function( $ ) {
    // Relocate Jetpack sharing buttons down into the comments form
    jQuery( '#sharing' ).html( jQuery( '.sharedaddy' ).detach() );
} );

The #sharing selector is just the DOM location where I want to move the buttons to, and the .sharedaddy one is the container that Jetpack places its buttons in normally. We just detach it from the normal position and then dump it into the new location exactly as it was.

We hope this helps you develop your theme and display things the way you like.

Posted in Misc, Tips & Tricks | Tagged , , , | 4 Comments

Changes to the Twitter Widget

Screen Shot 2013-04-30 at 11.25.38 AMIn Jetpack 2.2.3, released on April 26th, 2013, we introduced a new widget called the “Twitter Timeline” widget. This widget allows you to display your tweets on your blog in a much richer way then you could with the old Twitter widget. Users can retweet, favorite, and reply to you straight from your blog. The experience is also much closer to the experience of Twitter.com.

The old Twitter widget — which shipped with versions of Jetpack below 2.2.3 — will stop functioning on May 7th. This is because of some changes Twitter is making with how developers communicate with their service. Our new widget uses their timeline product which allows us to offer a solution that will continue working while providing additional features.

The old widget will gracefully stop returning output after May 7th. Any admins on your blog will receive a message asking them to switch to the new widget.

Let us know if you have any questions or what you think of the new widget in the comments below!

Posted in Misc | 17 Comments

Mind Rating Jetpack?

This has been a pretty exciting year for Jetpack, with numerous updates like countries being added to stats, subscriptions, contact forms, Jetpack comments, Carousel, and there’s some even more exciting things in the pipeline.

But despite the incredible adoption of the plugin and positive feedback we’ve been getting, Jetpack only has 3 of 5 possible stars on the plugin directory. That brings me to two points:

First, if you are having any trouble with Jetpack please let us know on the support forums (it’s even better than comments here). As the plugin says in its sidebar, “57 of 58 support threads in the last two months have been resolved.”

Second, if you’re a user of Jetpack please consider rating it in the directory. You need a WordPress.org account to do so, but once you log in it’s as easy as clicking the stars in the sidebar. Our rating is bogged down by feedback from over a year ago, and more than 12 times the number that has ever rated Jetpack install it on a daily basis. Even a few folks will make a big difference — thank you!

Posted in Misc | 60 Comments
Follow

Get every new post delivered to your Inbox.

Join 62,101 other followers