Jetpack

How to increase your blog’s traffic with Jetpack

Jetpack comes with a set of features specifically designed to help you increase your site’s traffic and grow your audience. That is after all the reason we build websites and blogs and write content – for people to see them, read them and enjoy them :-)

Jetpack helps you tackle this along two fronts: attracting new visitors to our sites and encouraging the existing ones to keep coming back.

 

Getting more traffic

Its worth mentioning what countless people have said before: writing well-written, useful and targeted content is eighty percent of the job. Neither Jetpack, nor any other plugin, is a silver bullet that can ever be a substitute for that. However, if you’ve got that nailed, these features will help you with the other twenty percent:

  1. Publicize
    Jetpack PublicizePublicize simply automates what you probably do already: posting your articles directly to Twitter, Facebook, LinkedIn and a few more social networks. Once you set this up (about 5 minutes usually) you can sit back and not worry about this and focus on writing great content while your friends and followers read what you’ve just posted.

  2. Sharing
    The Sharing feature, when enabled, places share buttons at the bottom of your blog posts. This allows (and encourages!) your readers to share your content with their own networks giving you broader reach. Currently we supprt Twitter, Facebook, Reddit, StumbleUpon, Digg, LinkedIn, Google +1, Print, and Email. Additionally you can define your own custom services.

  3. Site Verification
    Verifying your website with external services like Google, Bing and Pinterest. This means you will be rated as “safe” by these services (e.g. by getting a “Verified” badge) and gives you to access advanced features (e.g. Webmaster tools).

  4. Enhanced Distribution
    At WordPress.com we have a service called “Firehose” which is a stream of the public data (public posts, comments, etc.) that flow through WordPress.com as well as Jetpack blogs that enable Enhanced Distribution. The firehose in turn is used by companies and people to display your content at which point they are required to link back to your blog. This means that you get both traffic back to your site as well as building up quality back-links.

  5. Google+ Profile
    Sharing_Settings_GoogleLastly, when you activate and connect this feature you connect your blog and with your Google+ accounts. Now, displayed below your posts, will be a link back to your Google+ profile, a Google+ follow button and a link will also be added to your Google+ profile allowing Google+ users to find you more easily.

 

Keep them coming back

The other side of the coin is staying in touch with the visitors who’ve seen and read your content so that they don’t forget about you and come back to see what else you have to say. You may not necessarily want to use all of these of course as it depends a lot on the kind of site or blog you’re running. But because Jetpack makes it easy to turn these on and off some of our users opt to try things one at a time to test out their effect.

  1. Jetpack Comments
    Comment Module NotificationsComments are a great way of enabling your visitors to join the conversation. It can be a pain for them however to have to creat a new account if its their first time visiting your site. Jetpack Comments enables your visitors to use their existing WordPress.com, Twitter, or Facebook accounts when commenting on your site making it more likely they’ll do so.

  2. RSS Widget
    RSS is used by millions of people to keep track of blogs they like. When you enable Extra Sidebar Widgets in Jetpack you can show widget that allows you to add links to your blog’s RSS feeds in your sidebar. This makes it easy for your readers to stay updated when you post new content or receive new comments.

  3. Likes
    Likes MetaboxLikes allow your readers to show their appreciation for your posts and other published content. They will then be able to review their liked posts from their WordPress.com Reader which will remind them your blog exists and encourage them to come back.

  4. Subscriptions
    Easily allow any visitor to subscribe to all of your posts via email through a widget in your blog’s sidebar. Every time you publish a new post, WordPress.com will send a notification to all your subscribers. Depending on their preferences this notification will either show up on their WordPress bar (top right) or they will receive an email directly in their inbox.

  5. Notifications
    Example of a comment Push Notification from the WordPress for iOS app

    Example of a comment Push Notification from the WordPress for iOS app

    Finally, this last one is for you, the site owner. With Notifications enabled you will be instantly notified when somebody comments on any of your posts or previous comments. This means that you can instantly comment back making your interaction with your readers feel more personal and in real-time.

 

And of course, Jetpack also gives you great stats so that you can see the effect of your work! If you’ve not used Jetpack before, read our step-by-step installation guide here to try it out for yourself.

If you are a Jetpack user already please tell us what you think in the comments and, if you’d like to get involved by writing a guest post about Jetpack get in touch!

Posted in Tips & Tricks | Tagged , , , , , , | 6 Comments

How to add a default fallback image if no image can be found in a post

When you publish a new post on your site, Jetpack crawls it and looks for images that can be used when sharing that post on Facebook, on Twitter, or if that post appears in the Top Posts and Pages widget in your sidebar.

Jetpack starts by looking for a Featured Image. If you didn’t define any, we will look for slideshows and galleries, and then for single images you may have inserted in your posts. If you’ve inserted an image that is hosted on another site, we can use it too.

However, sometimes you may not have added any image to your post. In such cases, you can add this code snippet to your theme’s functions.php file, or in a functionality plugin. This way, your readers will see a default image when sharing that post on Facebook, for example:

function jeherve_custom_image( $media, $post_id, $args ) {
	if ( $media ) {
		return $media;
	} else {
		$permalink = get_permalink( $post_id );
		$url = apply_filters( 'jetpack_photon_url', 'YOUR_LOGO_IMG_URL' );
	
		return array( array(
			'type'	=> 'image',
			'from'	=> 'custom_fallback',
			'src'	=> esc_url( $url ),
			'href'	=> $permalink,
		) );
	}
}
add_filter( 'jetpack_images_get_images', 'jeherve_custom_image', 10, 3 );

It’s worth noting that the fallback image has to be larger than 200 x 200px, as per Facebook requirements. If your image is smaller, Facebook will ignore it.

Reference

Posted in Code snippets, Tips & Tricks | Tagged , , , , | Comments Off

Remove Jetpack Sharing buttons in the Mobile Theme

You can add the following code to a functionality plugin to remove the Jetpack Sharing buttons in the Mobile Theme:

// Check if we are on mobile
function jetpackme_is_mobile() {

    // Are Jetpack Mobile functions available?
    if ( ! function_exists( 'jetpack_is_mobile' ) )
        return false;

    // Is Mobile theme showing?
    if ( isset( $_COOKIE['akm_mobile'] ) && $_COOKIE['akm_mobile'] == 'false' )
        return false;

    return jetpack_is_mobile();
}

// Let's remove the sharing buttons, but only if we're on a mobile device
function jetpackme_maybe_add_filter() {

    // On mobile, and on the home page?
    if ( jetpackme_is_mobile() ) {
        remove_filter( 'the_content', 'sharing_display', 19 );
		remove_filter( 'the_excerpt', 'sharing_display', 19 );
    }
}
add_action( 'wp_head', 'jetpackme_maybe_add_filter' );

// Build the function
function jptweak_remove_share() {
	remove_filter( 'the_content', 'sharing_display', 19 );
	remove_filter( 'the_excerpt', 'sharing_display', 19 );
}

Looking for more mobile tips? You’ll find them here!

Posted in Code snippets, Tips & Tricks | Tagged , , | Comments Off

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

How to insert another plugin before the Jetpack sharing buttons

Jetpack sharing buttons are added immediately after the post content. In some cases, you may want to insert a new element between your post content and the sharing buttons.

To control whether that element will appear before or after the Jetpack sharing buttons, you will have to change the priority of the filter. In the example below, we’ve added an author box and used the priority 18. As long as the priority is less than 19, it will appear before the sharing buttons.

Posted in Code snippets, Tips & Tricks | Tagged | Comments Off

How to use your own resources in the sharing module

The sharing module includes an “advanced” option, allowing you to use your own Javascript and CSS files instead of the files added by Jetpack by default.

To get started, go to Settings > Sharing in your dashboard, and check the “Advanced” checkbox at the bottom of the page.

Then, you can add your own libraries by adding the following code in a functionality plugin or in your theme’s functions.php file:

function tweakjp_add_sharing_js() {
    wp_enqueue_script( 'sharing-js', WP_SHARING_PLUGIN_URL . 'sharing.js', array( ), 3 );
}
add_action( 'wp_enqueue_scripts', 'tweakjp_add_sharing_js' );

function tweakjp_add_sharing_css() {
    wp_enqueue_style( 'sharing', WP_SHARING_PLUGIN_URL. 'sharing.css', false, JETPACK__VERSION );
}
add_action( 'wp_enqueue_scripts', 'tweakjp_add_sharing_css' );

Once you’ve checked the option, you will be able to manually enqueue your own sharing js and css files.

You’ll note that Jetpack uses the WP_SHARING_PLUGIN_URL constant to build the path to load the libraries. You will have to change that constant by your own when reenqueueing the sharing libraries.

Reference

Posted in Code snippets, Tips & Tricks | Tagged | Comments Off

Adding reCaptcha to the Email Sharing Button

How do I add reCaptcha to the Email button

The Email button is great, and you can make it even better by adding a Captcha to the submission form:

reCaptcha for Jetpack

To add the Captcha to your site, follow these steps:

  1. Start by registering on this site. Upon registration, you will receive a Public and a Private key.
  2. Open your site’s wp-config.php file in your favorite text editor, and add the following constants with both reCaptcha keys right before /* That's all, stop editing! Happy blogging. */:
    define( 'RECAPTCHA_PUBLIC_KEY', 'XXXXXXX' );
    define( 'RECAPTCHA_PRIVATE_KEY', 'XXXXXXX' );
    
  3. Voila! Your email sharing buttons are now protected against spammers!
Posted in Code snippets, Tips & Tricks | Tagged , , , | 1 Comment
Follow

Get every new post delivered to your Inbox.

Join 63,495 other followers