Tweaking the "Related Episodes" list

Hello community!

Release 2.3.0 introduced the “Related Episodes” module. This feature might come in handy for some of us. Thanks for adding it!
I’m trying to implement this new feature into my template in a way that suits my needs. By default, [podlove-related-episodes] only returns a list of the chosen, related episodes. To provide more context, I also added “Zugehörige Episoden:” to my template. This looks as follows:

1 Zugehörige Episoden:
2 [podlove-related-episodes]

My problem is obviously, that Zugehörige Episoden: gets displayed, even if I didn’t specify any related episodes.
How can I set up my template in a way that line 1 only gets displayed if line 2 ([podlove-related-episodes]) actually returns a list of episodes? Or the other way round: How can I hide Zugehörige Episoden: if there are no related episodes?

Include the optional text inside the shortcode: [podlove-related-episodes] optional text [/podlove-related-episodes]

1 Like

There is a short template-snippet I put on GitHub that answers your question:

The text is in German but I hope it is self-explanatory. Otherwise don’t hesitate to ask…

1 Like

Thanks to both of you! Tim’s answer did work just fine.

Please note the Shortcode [podlove-related-episodes] might be renamed to [podlove-episode-related-episodes] in an upcoming release (it has been inconsistently named).

How can I write it if I only want this box to appear if a related episode actually exists?

That’s the case by default - at least for me. Related episodes will only be displayed if there is at least one related episode.

{% set related_episodes = episode.relatedEpisodes %}

{% if related_episodes %}

<h6><strong>Zugehörige Episoden:</strong></h6>

{% for related_episode in related_episodes %}
		<a href="{{ related_episode.url }}">{{ related_episode.title }}</a>
{% endfor %}

{% endif %}

1 Like

Hi, I need help with this, I have a page that include the following shortcode

[podlove-episode-web-player post_id=“12300”]

Related Episodes is enabled in the settings, in the WebPlayer settings I have “Podcast” selected, the episodes have related episodes assigned, the problem is that I’m also getting episodes from non-related podcasts/shows. I see some suggestions here but not sure how to use it with the current shortcode.

Please help


can you post a link?

My assumption: The episodes you chose to be “related episodes” and the “related episodes” in the web player are not the same thing. It’s slightly confusing. One might think that the web player will show the chosen related episodes as related episodes, but it doesn’t. @zusatzstoff will be able to provide further insight.

Yep that is correct. “Related Episodes” from the Publisher aren’t integrating with the Web Player “Related Episodes” since they are bound to the Episode context.