Les secrets de Jetpack — WordCamp Paris

Pour ma première participation à WordCamp Paris, j’ai décidé de parler d’un sujet qui me tient à coeur : Jetpack !

Voici donc ma présentation : en attendant que la vidéo soit mise en ligne, vous pouvez parcourir mes notes ci-dessous, jeter un coup d’oeil à mon diaporama, tout en écoutant mes commentaires dans la vidéo au bas de cet article.

Découvrez les secrets de Jetpack pour gagner du temps dans vos projets

Jetpack: add UTM tracking to sharing buttons

After figuring out a nice little challenge in the Jetpack support forums last week, I wanted to share the results with you.

First of all, I need to thank Aquif Shaikh for his question in the original thread. This thread required a bit more digging than usual, and I love a good challenge.

The question was actually quite simple: how to add UTM tracking to the Jetpack sharing buttons. If you’re not familiar with UTM tracking, you’ll want to check this generator. UTM tracking allows you to track specific URLs in Google Analytics.

Let’s get started.

Continue reading

New theme, new logo, new PHP!

Fresh coat of paint for my blog: new theme, new logo, new version of PHP, and HTTP/2!

Check our the new looks

Color Posts: an update for your Android readers

About a year ago I released a small plugin named Color Posts. It’s a fairly simple plugin, and it can be extended with filters. I use it on this site, and I’ve made extensive use of the filters to add some color to the sidebar as well as in other areas of the site.

Among all these customizations, there is one that I really like: if you use Chrome in Android, the browser’s background color matches the color picked by my plugin:

2015-11-23 11.14.33
Color Posts changes Chrome’s background color to match the post’s color.

I thought this little detail could be useful for everyone, so added it to the plugin itself! If you use Color Posts, go update now! 😊

Jetpack: redirect your subscribers to a Thank You page

Jetpack includes a Subscriptions module that makes it easy for your readers to subscribe to your site, and then receive email or Reader notifications for each one of the posts you publish on your site.

Your readers can use a Subscription widget to subscribe to your site. You can see how it looks on this very site (oh, and subscribe if you haven’t already 😊 ).

By default, when submitting your email address into the form, the page reloads and success message appears instead of the email form. However, starting with Jetpack 3.8, you can now redirect your subscribers to a specific page on your site instead. It could be a “Thank You” page, it could be a little explanation of what they need to do to confirm their subscription, … That’s up to you.

To create that redirection, you can use the new jetpack_subscriptions_form_submission action, like so:

/**
 * Redirect all successful subscription submissions to a 'thank-you' page
 */
function jeherve_custom_sub_redirect_page( $result ) {
	if ( 'success' === $result ) {
		$thanks_page = 'thank-you';
		wp_safe_redirect( $thanks_page );
		exit;
	}
}
add_action( 'jetpack_subscriptions_form_submission', 'jeherve_custom_sub_redirect_page' );

Place that code in a functionality plugin, and you’re all set!

An experiment with the WP REST API and Jetpack’s REST API

A few months ago, I set to learn more about the differences between Jetpack’s REST API and the WP REST API plugin. Both projects are very interesting for the future of WordPress, as they allow third-party apps and services to interact with WordPress.

I consequently developed a little plugin using both APIs: REST API Post Embeds.

Learn more about the plugin

Jetpack: how to deal with missing images in the Related Posts module

Jetpack Related Posts are great. You should use them!

They are also customizable; we added a lot of filters to allow you to customize the output of the Related Posts. You can find a lot of examples here: Customize Related Posts (Kudos to Xiao for all the great work he’s done with Jetpack Related Posts).

The module also includes an option to “use a large and visually striking layout”. When that option is active, Jetpack will look for a large image (at least 350*200px) in your posts, and use that image when displaying Related Posts. It looks great, and I use it on this site:

Related Posts

What doesn’t look that good, however, is when some of the Related Posts don’t have any image.

Missing Related Image

There are 2 ways to solve this small issue.

Continue reading

A Commitment to Backwards Compatibility – Pippin Williamson

Pippin Williamson of Pippin’s Plugins talked about Backwards Compatibility. If you develop plugins or themes, I’d recommend watching that video: Pippin offers some great advice about things to keep in mind when maintaining a plugin.

Jetpack: remove a post from the Top Posts Widget

If you use the Jetpack plugin, you’re probably familiar with the Stats module. Once you’ve activated the module, you can also use the Top Posts widget to display a list of the most popular posts on your site.

But what if there is one post that you never want to display there, even if it’s a popular one? You can exclude specific posts from the widget thanks to the jetpack_widget_get_top_posts filter.

To do so, paste the following code into a functionality plugin:

function jeherve_remove_post_top_posts( $posts, $post_ids, $count ) {
	foreach ( $posts as $k => $post ) {
		// Replace 1215 by the ID of the Post you want to remove
		if ( '1215' == $post['post_id'] ) {
			unset( $posts[$k] );
		}
	}
	return $posts;
}
add_filter( 'jetpack_widget_get_top_posts', 'jeherve_remove_post_top_posts', 10, 3 );

Get a headstart with install.php & Jetpack – Timișoara WordPress Meetup

I was invited to Timișoara to give a talk about Jetpack, and got to meet with the local WordPress community. It was a great meetup. Kudos to the folks from Presslabs, Rainfall, Cosmoslabs, and Get Bowtied. Thanks for being so welcoming. I’ll come again!

I chose to talk about install.php, and how you could use it alongside mu-plugins and functionality plugins to speed things up when installing new WordPress sites. Here are my slides:

Get a headstart with install.php & Jetpack

You can also check the slides on GitHub.

Here is the full install.php I created for the purpose of this talk. Credit goes to Mike Schinkel and Kathy for a big part of the functions in there.

If you have questions about some of the Jetpack filters used in the talk, or if you would like to see more filters added to Jetpack, do not hesitate to join us on GitHub!