Display an episode list for a show?

Is there a way to get a list of show episodes to display on a page? Similar to the [podlove-episode-list] shortcode, but only for one show. I tried [podlove-episode-list show=“show-slug”], but it did nothing.

AFAIK there is no shortcode for that, you will have to write your own template. That’s quite easy: Open Podlove|Templates and add a new one. Enter a title of your liking and do it like this:

{% if option.show %}
  {% set show_title = show %}
{% endif %}

<h1>Episodes of {{ show_title }}:</h1>
<table>
    <thead>
        <th></th>
        <th>Date</th>
        <th>Title</th>
        <th>Duration</th>
    </thead>
    <tbody>
      {% for episode in podcast.episodes %}
        {% if episode.show == show_title %}
          <tr class="podcast_archive_element">
            <td class="thumbnail">
                {{ episode.image({fallback: true}).html({width: 64, height: 64}) }}
            </td>
            <td class="date">
                <span class="release_date">
                    {{ episode.publicationDate }}
                </span>
            </td>
            <td class="title">
                <a href="{{ episode.url }}">
                    <strong>{{ episode.title }}</strong><br>
                    {{ episode.subtitle }}
                </a>
            </td>
            <td class="duration">
                {% set duration = episode.duration %}
                {{ duration.hours }}:{{ duration.minutes|padLeft("0",2) }}:{{ duration.seconds|padLeft("0",2) }}
            </td>
        </tr>
      {% endfor %}
    {% endif %}
    </tbody>
</table>

<style type="text/css">
.podcast_archive_element .thumbnail {
    width: 64px;
    padding: 5px !important;
}

.podcast_archive_element td {
    vertical-align: top;
}
</style>

After saving your Template you will find a short code at the bottom left of the page, which looks like this: [podlove-template template="Template Title"] You can add this on a Wordpress page and add show="Show Title" into the brackets. I couldn’t test this since I don’t use shows in my installations, but I’m pretty confident, this should work.

1 Like

Thanks!

Argh, sorry, endif and endfor are in the wrong order. You’ll have to switch them around.

1 Like

Ok, I must have something wrong. I made a template, called it “showshow” and swapped the endif and endfor statements.

When I use the shortcode, I am getting a full list of all episodes.

The part at the top of the template that should display the show name doesn’t include it.

I use the shortcode:

[podlove-template template=“showshow” show=“Reading Short and Deep”]

And the message at the top of the list displays:

Episodes of :

Instead of my expected:

Episodes of Reading Short and Deep:

And if I add an {{episode.show}} into the template, nothing is output, even though the rest of the show data displays fine. But that would explain why all shows are displayed on the list, as episode.show and show_title are both empty strings.

Any thoughts as to what I have wrong?

Ok, templates were definitely the way to go. I still need to do styling, but this is the basic for how I have it working now:

{% set option = {
theshow: ‘sffaudio’
}|merge(option) %}

<ul>
{% for episode in podcast.episodes({show:option.theshow}) %}
<li>
<a href=“{{ episode.url }}”>
{{ episode.title }}
</a>
</li>
{% endfor %}
</ul>

Thanks for pointing me in the right direction!

1 Like

Oh yes, that’s way more elegant than my approach. :smiley: