Jetpack: Add Related Posts to your RSS feed

I got an interesting question in the Jetpack support forums today. Levy wanted to display Related Posts in their RSS feed.

Jetpack displays Related Posts at the bottom of single posts by default, but like with other modules, you can customize Related Posts. In this post, we’ll use the the_content filter and the raw Jetpack Related Posts class to build our own unordered list of Related Posts, and add it to the bottom of the post content in RSS feeds.

Quick note before we start:

  • You’ll want to add that code to a functionality plugin like this one.
  • Nothing will happen if you’re not using Jetpack and its Related Posts module.
 * Add Jetpack Related Posts to RSS feed.
 * @see
function jeherve_related_posts_feed( $content ) {
	// Return early if we're not in the RSS feed.
	if ( ! is_feed() ) {
		return $content;

	// If Jetpack and Related Posts are active, let's get started.
	if ( class_exists( 'Jetpack_RelatedPosts' ) && method_exists( 'Jetpack_RelatedPosts', 'init_raw' ) ) {
		$related = Jetpack_RelatedPosts::init_raw()
			->set_query_name( 'jetpackme-shortcode' ) // Optional, name can be anything
				array( 'size' => 3 )

		if ( $related ) {
			$related_list = '';

			foreach ( $related as $result ) {
				// Get the related post IDs
				$related_post_id = get_post( $result[ 'id' ] );

				 * From there you can do just about anything, using the post IDs.
				 * In this example, we'll build an unordered list.
				$related_list .= sprintf(
					'<li><a title="%1$s" href="%2$s">%3$s</a></li>',
					esc_attr( get_the_title( $related_post_id ) ),
					get_permalink( $related_post_id ),
					get_the_title( $related_post_id )

			 * Let's wrap all those related posts in ul tags, and add that list to the end of our post content.
			 * We will also add a headline, but only if it was set to be displayed in your Jetpack Related Posts settings.
			$related_options = Jetpack_Options::get_option( 'relatedposts' );
			if ( $related_options['show_headline'] ) {
				$headline = sprintf(
					'<h3 class="jp-relatedposts-headline"><em>%s</em></h3>',
					esc_html__( 'Related', 'jetpack' )
			} else {
				$headline = '';

			return sprintf(
				'%1$s%2$s<ul class="jp-relatedposts">%3$s</ul>',
				apply_filters( 'jetpack_relatedposts_filter_headline', $headline ),

		return $content;

	// Last fallback, just in case Jetpack and Related Posts aren't there anymore.
	return $content;
add_filter( 'the_content', 'jeherve_related_posts_feed' );

TV Series: Better Call Saul

To this day, Breaking Bad still is one¬†of my favourite TV Shows. The story, the photography, the characters, the soundtrack, … That show brought TV Shows to a new level. I was thrilled when I learned that one of the characters, Saul Goodman, would get his own show, created by Vince Gilligan and Peter Gould, who also worked on Breaking Bad.

Continue reading

Doctor Strange

You wonder what I see in your future? Possibility.

Yup, Marvel’s Doctor Strange is coming,¬†and they picked the best actor for the role, Benedict Cumberbatch.


You want to go see that movie.

For those of you not familiar with Doctor Strange back-story: Stephen Strange is a selfish, arrogant, and super-talented neurosurgeon; his hands are obviously super important to him as a surgeon. One day,¬†he gets into a car accident, his hands are badly damaged, and he can’t perform surgeries anymore. He searches¬†for a cure for a long time, until he finds The Ancient One, one of the most powerful sorcerers there is. The Ancient One becomes his mentor, until one day Strange¬†becomes Sorcerer Supreme. Magic!

Marvel is really killing it lately:

  • Several movies, exploring different heroes and stories of the Marvel universe, including some superheroes that we might not have thought worthy of a movie before (Ant-Man, Vision, …);
  • Movies featuring anti-heroes, like Deadpool or Guardians of the Galaxy;
  • A tie-in show (Agents of S.H.I.E.L.D) getting popular enough to last for 3 seasons;
  • A tie-in show linked to that tie-in show (Agent Carter);
  • 2 seasons of Daredevil, featuring the Punisher;
  • Jessica Jones, Luke Cage, and the Iron Fist getting their own shows;
  • The Defenders, bringing them all together;
  • And now, Doctor Strange!

I can’t wait to see that movie.

Color Posts update for AMP

AMP Screenshots

If you follow the news, you most likely heard about the Accelerated Mobile Pages Project in the past few weeks. This open source initiative, lead by Google and a few big publishing and technology companies, allows you to serve super fast pages to mobile readers, when they come from a Google Search result or from an app using AMP:

How AMP looks like when launching a Google search

Automattic joined the project and released the AMP plugin, so you can enable AMP on your own site with a few clicks.

It’s not super pretty, though. By default, AMP pages sport a standard blue title bar. That’s where Color Posts comes in! ūüėä ¬†I just updated the plugin, and it will now change the look of the title bar to match the post’s main color.

All you have to do is install the AMP plugin, and update Color Posts!

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