Jetpack 3.9 — Sitemaps, a new Skype Sharing Button, and More

With the release of Jetpack 3.9, we’re introducing a brand new module, as well as a lot of improvements for several existing Jetpack modules.

Jetpack’s new Sitemaps Module

Jetpack already includes features like Subscriptions and Publicize, to let your readers know whenever you publish a new post on your site. You can now let Search Engines know, too!

What are sitemaps? Sitemaps are files that list each post and page that should be indexed by search engines like Google or Bing.

Once this new module is activated, two sitemaps will be created: a generic sitemap, available at yoursitename.com/sitemap.xml, as well as a News Sitemap, available at yoursitename.com/news-sitemap.xml. The News sitemap is useful if you want your posts to appear in Google News.

You can learn more about this new module here.

A new Skype Sharing Button

Skype Sharing Button

Now that Skype offers a Skype button, we’ve added it to Jetpack’s Sharing module. To add it to your site, head over to Settings > Sharing in your dashboard, and drag the new Skype button to your list of sharing buttons.

Social Menu

Social Menu is a new tool that is available for all theme developers. It allows site owners to create a new menu location which is used to display links to Social Media Profiles.

To learn how to add Social Menu support to your theme, you can follow the instructions on our support page.

And More…

This release also adds its fair share of improvements to existing modules, as well as bug fixes:

  • Added new options to allow management of users on your site directly from WordPress.com or from the WordPress.com Desktop app.
  • Made several changes to Photon to improve compatibility with WordPress 4.4. Custom image sizes are handled better now and all responsive image sizes will be properly displayed when using the Photon module.
  • Photon is now enabled by default on sites using HTTPS. You don’t need to use a filter to enjoy Photon on your HTTPS site anymore!
  • Added support for Wistia oEmbeds.
  • Fixed some issues with long album and track IDs in the BandCamp shortcode. Also added support for two new parameters: tracks and esig.
  • And a lot more! You can check the full changelog here.

Once again, a big thank you to all Jetpack Contributors:

Alex Shiels, Andrew Duthie, Andrew Ozz, Andy Peatling, Biser Perchinkov, Brandon Kraft, Dan Robert, Derek Smart, Dion Hulse, Miguel Polfliet, Eduardo Reveles, Elio Rivero, Eric Binnion, George Stephanis, Hiroshi Urabe, Igor Zinovyev, Jeff Golenski, Jennifer M. Dodd, Jeremy Herve, Jesse Friedman, Joen Asmussen, Joey Kudish, Jonathan Sadowski, Joseph Scott, Justin Shreve, Kat Hagan, Kelly Dwan, Lance Willett, Matt Wiebe, Michael Cain, Miguel Lezama, Rachel Baker, Richard Muscat, Rocco Tripaldi, Sam Hotchkiss, Scott Grant, Steve Seear, Stéphane Boisvert, Takashi Irie, Thomas Guillot, and Xiao Yu.

Posted in Releases | Tagged , , , , | 12 Comments

Hook of the Month: Customizing the Top Posts & Pages Widget

Let’s kick off 2016 with a new series: welcome to the first installment of¬†Hook of the Month!

Hooks are places in WordPress code where you can add your own code or change the default behavior of WordPress. Jetpack includes many of those hooks — 430 at the time of writing. In this series, I’ll introduce you to a new hook every month.

Today, let’s look at hooks help you customize one of our most popular widgets, the Top Posts & Pages widget.

Continue reading → Hook of the Month: Customizing the Top Posts & Pages Widget

Posted in Code snippets, Spotlight, Tips & Tricks | Tagged , , , , , , | 28 Comments

Jetpack users: Publish from your desktop with the WordPress.com app for Mac!

Great news for Jetpack users! With the release of the new WordPress.com, there are some exciting improvements for Jetpack users, too!

The Jetpack plugin¬†now gives your self-hosted sites access to the new¬†WordPress.com publishing and site-building tools —¬†and the brand new WordPress.com app for Mac, along with a host of features¬†to speed up, secure, and simplify site administration like automatic backups and plugin auto-updating.

Use the desktop app to focus on your content and design with no other browser tabs to distract you, or to keep your sites sidelined but accessible. Build your site anywhere, in whatever way helps you get your best work done: the app is powered by the same technology that runs WordPress.com, creating a seamless experience for publishing and browsing whether you’re in a browser, a mobile app, or the desktop!

(Windows and Linux users, we haven’t forgotten you! Visit the download page and sign up to be notified when your apps are available.)

Download the app

View the video below to see the improvements and an introduction to the new WordPress.com app for Mac:

To make sure you can take full advantage of the multisite management and publishing capabilities via the WordPress.com interface and the new WordPress.com app for Mac, turn on Jetpack Manage to enable site management in your plugin settings.

Learn more about the new WordPress.com and the WordPress.com app for Mac, the technologies underlying the new WordPress.com and the process of building it, or read what our CEO has to say about the changes. 

Posted in Uncategorized | 8 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 any images that may be attached to the post. If we don’t find any image attached to that post, we’ll look for single images you may have inserted in the post. 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 on How to add a default fallback image if no image can be found in a post

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 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 on How to disable the auto-activation of a Jetpack module

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 on How to load only a specific Jetpack module

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 on How to change the size of the thumbnails in the Top Posts widget

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 on Automatically close comments in the Carousel view

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 on Remove Jetpack Sharing buttons in the Mobile Theme
  • Recent Comments

    Jen H. on Building a Beautiful Photoblog…
    Leo on Building a Beautiful Photoblog…
    David Bennett on Building a Beautiful Photoblog…
    Jen H. on Building a Beautiful Photoblog…
    Soni on Building a Beautiful Photoblog…
  • Archives

  • Install Jetpack to see our line-up of features.

    Install Jetpack Now

    Don’t need all Jetpack’s features? No problem. Only activate what you need!

    Follow

    Get every new post delivered to your Inbox.

    Join 56,445 other followers