Jetpack

New Release: Jetpack 2.6

After two months of silence, here comes Jetpack 2.6! Chock-full of enhancements and goodness, we can’t wait for you to try it out.

New Modules: Single Sign On and Jetpack Monitor

Single Sign On replaces the previous WordPress.com Connect module, added in 2.4. Improving on the WPCC module’s setup process, Single Sign On takes one click to activate, then you’re off to the races! It will also streamline subsequent log ins, as you’ll no longer need a manual approval at sites where you’ve previously been authenticated.

Our other new module, Jetpack Monitor, is an uptime monitor that will check your site every five minutes. If it ever looks like your site is down, we’ll fire off an email to give you a heads-up. Easy, right?

We’ve also included a pile of other enhancements. We’ve switched the code editor in our Custom CSS module, and bundled new filters, new custom post types, and new widgets. We’ve added performance improvements across many modules, as well as support for WP-CLI. We now also make sure that your Publicize connections haven’t expired in the background as you write.

We’re tremendously proud of our latest release, and hope you’ll give it a shot.

- The Jetpack Team

Eight automatticians swimming in the carribean

The Jetpack Team recently spent a week collaborating on the awesomeness of this release down in Puerto Rico! Interested in joining us? You should apply!

Posted in Releases | 25 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

Ever accidentally publicize a post that you didn’t mean to?

Ever accidentally publicize a post that you didn’t mean to? This snippet will prevent the connections from being auto-selected, so you need to manually select them if you’d like to publicize something.

add_filter( 'publicize_checkbox_default', '__return_false' );

You can place this code snippet in your theme’s functions.php file, or in a functionality plugin.

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

How to Override Jetpack Infinite Scroll Settings in a Child Theme

From our illustrious colleagues over at ThemeShaper, I’d like to share with you a post on further customizing Infinite Scroll settings in your themes:

When a theme author adds Jetpack Infinite Scroll support to their theme, they configure its options specifically for that theme. Occasionally you might want to override the theme’s defaults for your purposes, and in this article, I’ll show you how to do so in a child theme.

Here is a typical Jetpack Infinite Scroll setup function…

Read the whole post: How to Override Jetpack Infinite Scroll Settings in a Child Theme.

Posted in Tips & Tricks | Comments Off

How to add Javascript events to the Carousel view

Add this to your site’s js to enable events such as adding Google Analytics tracking code to individual Carousel slides:

jQuery(document).on( 'jp_carousel.selectSlide', '.jp-carousel-wrap', function( event, slides ) {
	// This is just to show you what values get passed in.  Delete it before going to production.
	if ( window.console ) {
		console.log( this );
		console.log( event );
		console.log( slides );
		console.log( slides[0] );
	}
	// Do whatever extra stuff you want here.
} );

You can read more about it here.

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

How to disable the auto-activation of a Jetpack module

In Jetpack 2.6, we will introduce a new filter, jetpack_get_default_modules. It will allow you to stop the auto-activation of a specific Jetpack module.

Here is an example with the Widget Visibility module:

// To disable the auto-activation of Jetpack's Widget Visibility module:
add_filter( 'jetpack_get_default_modules', 'disable_jetpack_widget_visibility_autoactivate' );
function disable_jetpack_widget_visibility_autoactivate( $modules ) {
	return array_diff( $modules, array( 'widget-visibility' ) );
}

// Or, to disable the functionality in your own plugin if the user activates it in Jetpack:
if ( ! class_exists( 'Jetpack' ) || ! Jetpack::is_module_active( 'widget-visibility' ) ) {
	// It's not there, do as you like!
}

Reference.

If you wanted all Jetpack modules to be deactivated by default, you could use the following code:

add_filter( 'jetpack_get_default_modules', '__return_empty_array' );
Posted in Code snippets, Tips & Tricks | Tagged , , , , | Comments Off

Jetpack 2.5: Google Integration, VideoPress, and Facebook Embeds

In the latest update to Jetpack, we have some exciting new features to share with you including integration of Google services and products, adding VideoPress to our list of modules, and the ability to embed your Facebook updates into your blog posts. Let’s take a closer look at each of these new features!

(more…)

Posted in Releases | Tagged , , , , | 38 Comments

Jetpack 2.4: Widget Visibility and WPCC (and more!)

We’ve got a great update for you all including two new modules, three new shortcodes, and some updates and fixes to your favorite Jetpack modules!

(more…)

Posted in Releases | Tagged , | 12 Comments

How to load only a specific Jetpack module

Sometimes you do not want to see a specific module in the Jetpack menu. You might not use it at all, or you might want to make sure other admins can’t activate it.

For such cases, you can use the jetpack_get_available_modules filter to control the list of modules available in Jetpack.

Load only a specific Jetpack module

function tweakjp_only_stats ( $modules ) {
    $return = array();
    $return['stats'] = $modules['stats'];
    return $return;
}
add_filter( 'jetpack_get_available_modules', 'tweakjp_only_stats' );

Disable a specific module

function tweakjp_disable_stats ( $modules ) {
    unset( $modules['stats'] );
    return $modules;
}
add_filter( 'jetpack_get_available_modules', 'tweakjp_disable_stats' );
Posted in Code snippets, Tips & Tricks | Tagged , , , | Comments Off

How to change the size of the thumbnails in the Top Posts widget

The Top Posts widget offers different options to display a list of posts, or a grid of post thumbnails. In some cases, you might want to change the size of the thumbnails used by this widget.

To do so, you’ll need to change the size parameters in the image source, by adding the following code to your theme’s functions.php file, or to a functionality plugin:

function jeherve_custom_thumb_size( $get_image_options ) {
        $get_image_options['avatar_size'] = 600;

        return $get_image_options;
}
add_filter( 'jetpack_top_posts_widget_image_options', 'jeherve_custom_thumb_size' );

You can add some custom CSS to overwrite Jetpack’s default CSS. You can paste this CSS in yor theme’s stylesheet, or under Appearance > Edit CSS in your dashboard:

.widget_top-posts .widgets-list-layout-blavatar {
    max-width: 600px;
}
Posted in Code snippets, Tips & Tricks | Tagged , | Comments Off
Follow

Get every new post delivered to your Inbox.

Join 62,884 other followers