Jetpack

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

Automatically close comments in the Carousel view

You can use the following code to automatically close comments in the Carousel view, based on the number of days you’ve defined in Settings > Discussion:

function jpcarousel_auto_close_comments( $open, $post_id ) {
	$post = get_post( $post_id );

	$days_old = (int) get_option( 'close_comments_days_old' );

	if ( ! $days_old )
		return $open;

	if( $post->post_type == 'attachment' && time() - strtotime( $post->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) {
		return false;
	}
	return $open;
}
add_filter( 'comments_open', 'jpcarousel_auto_close_comments', 10 , 2 );
Posted in Code snippets, Tips & Tricks | Tagged , | Comments Off

Make Sure Your Functions Function: Unit Testing

Hopefully you’ve checked out our new contributor guide and you’re ready to submit your first patch — thanks! But before you send your .diff out into the world, run a unit test to make sure everything’s working as it should.

(more…)

Posted in Contribute, Tips & Tricks | Tagged , | 1 Comment

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

Jetpack 2.3.5: Share Your Path Moments with Publicize

Jetpack 2.3.5 is out and contains an update to our Publicize feature! Our Publicize feature is a quick, simple way to build your readership and share your latest content automatically on other social networks, including Facebook, Twitter, Tumblr, and LinkedIn.

Working with our good friends at Path, we’re excited to announce that you can now connect your WordPress blog and Path account. Once connected, when you create new content on your site, a Path “moment” will also be created, with a link back to your site.

Read the Path announcement on WordPress.com to find out more.

Posted in Features, Releases | 6 Comments

Want to contribute to Jetpack? Here’s how!

What? Me? Contribute to Jetpack?

That’s right. While we’re hard at work bringing you more Jetpack features, we need your help! What can you do? Why, thank you for asking!

(more…)

Posted in Contribute | Tagged , , , , | 4 Comments

How to disable specific shortcodes in Jetpack

Jetpack includes many shortcodes allowing you to embed videos, audio files, images, and other media into your posts.

If you want to deactivate a specific shortcode without deactivating the Shortcodes module, you can add the following code to your theme’s functions.php file, or to a functionality plugin:

function my_remove_shortcode_function( $shortcodes ) {
	$jetpack_shortcodes_dir = WP_CONTENT_DIR . '/plugins/jetpack/modules/shortcodes/';
	
	$shortcodes_to_unload = array( 'ted.php', 'soundcloud.php', );

	foreach ( $shortcodes_to_unload as $shortcode ) {
		if ( $key = array_search( $jetpack_shortcodes_dir . $shortcode, $shortcodes ) ) {
			unset( $shortcodes[$key] );
		}
	}
		
	return $shortcodes;
}
add_filter( 'jetpack_shortcodes_to_include', 'my_remove_shortcode_function' );

In the code above, you’ll need to add to or remove shortcodes from the $shortcodes_to_unload array. It requires the file name of the shortcode you want to deactivate.

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

Jetpack 2.3.4

Jetpack 2.3.4 is out! Included are a number of bug fixes and enhancements — from using the freshest Genericon assets to improving many of our translations, it’s the best Jetpack yet.

We’ve also lightened the load by dropping many of the “retina display” versions of WordPress Core assets that core has had come bundled with since 3.5. If you’re still running WordPress 3.4, it may be time to look at upgrading!

For a full changelog, check out http://wordpress.org/plugins/jetpack/changelog/

Posted in Uncategorized | Tagged , , | 4 Comments
Follow

Get every new post delivered to your Inbox.

Join 61,579 other followers