Wie kann ich in Templates Shows filtern?

Wie kann ich in meinem episode-list Template die Ausgabe auf eine Show (Beta 2.7) begrenzen? Ich nutze zur Zeit dieses template:

> {# @core/shortcode/episode-list.twig #}
> 
> <table>
>     <thead>
>         <th width=10%></th>
>         <th width=15%>Date</th>
>         <th width=10%>Nr</th>
>         <th width=30%>Title</th>
>         <th width=15%>Duration</th>
>     </thead>
>     <tbody>
>     {% for episode in podcast.episodes %}
>         <tr class="podcast_archive_element">
>             <td class="thumbnail">
>                 {{ episode.image({fallback: true}).html({width: 64, height: 64}) }}
>             <td class="date">
>                 <span class="release_date">
>                     {{ episode.publicationDate }}
>                 </span>
>             </td>
>             <td class="episode">
>                 <span class="episode_number">
>                     {{ episode.number }}
>                 </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 %}
>     </tbody>
> </table>
> 
> <style type="text/css">
> .podcast_archive_element .thumbnail {
>     width: 64px;
>     padding: 5px !important;
> }
> 
> .podcast_archive_element td {
>     vertical-align: top;
> }
> </style>
{% for episode in podcast.episodes %}
    {% if episode.show.slug == "my_show_slug" %}
        <tr> ... </tr>
    {% endif %}
{% endfor %}

Aber du brauchst mindestens beta build 485.

1 Like

Danke Eric,

leider hat das nicht funktioniert, trotz neuester Version.

Slug ist frell/Frell-000 in der Episodenbeschreibung, der Aufruf mit dem Player funktioniert.

Die Episodenliste sieht so aus:
https://serienrepublik.de/frell-2/

und das Template so:

image

Der Hauptpodcast funktioniert ganz normal, wie zuvor.

Wenn die Seite ganz leer ist, wird es ein Syntaxfehler sein. Solltest du im PHP Error Log finden.

Hast du daran gedacht, auch {% endif %} einzufügen? Ist auf dem Screenshot nicht ersichtlich.

Apache2/error.log sagt das:

[Sun Mar 18 18:50:37.334339 2018] [:error] [pid 16971] [client 78.35.50.187:51394] PHP Warning: Missing argument 2 for podlove_maybe_override_post_titles(), called in /var/www/wordpress/wp-includes/class-wp-hook.php on line 286 and defined in /var/www/wordpress/wp-content/plugins/podlove-podcasting-plugin-for-wordpress/includes/auto_post_titles.php on line 12

Hier der vollständige Template Code, sag jetzt nicht, es liegt an Tabs? :wink:

{# @core/shortcode/episode-list.twig #}    
<table>
        <thead>
            <th width=10%></th>
            <th width=15%>Date</th>
            <th width=10%>Nr</th>
            <th width=30%>Title</th>
            <th width=15%>Duration</th>
        </thead>
        <tbody>
        {% for episode in podcast.episodes %}
         {% if episode.show.slug == "frell" %}
            <tr class="podcast_archive_element">
                <td class="thumbnail">
                    {{ episode.image({fallback: true}).html({width: 64, height: 64}) }}
                <td class="date">
                    <span class="release_date">
                        {{ episode.publicationDate }}
                    </span>
                </td>
                <td class="episode">
                    <span class="episode_number">
                        {{ episode.number }}
                    </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>
         {% endif %}
        {% endfor %}
        </tbody>
    </table>

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

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

error.log sagt eigentlich sonst nichts weiter über Podlove…

Also noch mal der Vollständigkeit halber, ich habe jetzt alles durchprobiert, die Episodenliste auf Basis des Showslugs funktioniert nicht.

Ich schau’s mir an.

Gibts etwas neues dazu? Die Episodenliste funktioniert immer noch nicht… wenn ich das Slug if rauslasse wird die Gesamt Episodenliste des Hauptcasts angezeigt. Sobald das if drin ist, bleibt die Seite leer.

Sollte ab Version 2.7.5 funktionieren. Auch neu, und zu bevorzugen: {% for episode in podcast.episodes({show: "example"}) %}

Sollte, tut es aber nicht. :wink:

Schau selbst: https://serienrepublik.de/frelleps/
(alles was ein blaues Logo hat ist die Show, alles was ein orange-blaues Kameralogo hat ist der Hauptcast)

Dieses Template steckt dahinter:

{# @core/shortcode/episode-list.twig #}

<table>
    <thead>
        <th width=10%></th>
        <th width=15%>Date</th>
        <th width=10%>Nr</th>
        <th width=30%>Title</th>
        <th width=15%>Duration</th>
    </thead>
    <tbody>
     {% for episode in podcast.episodes({show: "Frell"}) %}
                <tr class="podcast_archive_element">
                <td class="thumbnail">
                        {{ episode.image({fallback: true}).html({width: 64, height: 64}) }}
                <td class="date">
                        <span class="release_date">
                        {{ episode.publicationDate }}
                        </span>
                </td>
                <td class="episode">
                 <span class="episode_number">
                     {{ episode.number }}
                 </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 %}
    </tbody>
</table>

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

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

Und das sind die Showeinstellungen:

06

Log:

Website                    https://serienrepublik.de
PHP Version                7.0.28-0ubuntu0.16.04.1
WordPress Version          4.9.5
WordPress Theme            Sparkling v2.3.5
Active Plugins             
           - All-in-One Event Calendar von Time.ly v2.5.30
           - Antispam Bee v2.7.1
           - Authors Page v1.6
           - BuddyPress v2.9.4
           - Contact Form 7 v5.0.1
           - Growmap Anti Spambot Plugin v1.5.6
           - Limit Login Attempts v1.7.1
           - Media File Manager v1.4.2
           - Podlove Beta Tester v1.1.3
           - Podlove Podcast Publisher v2.8.0.build524
           - Simple Trackback Validation with Topsy Blocker v1.2.7
           - SpeakPipe - Voicemail for Websites v0.2
           - SSL Insecure Content Fixer v2.5.0
           - WP Biographia v3.3.2
           - WP Statistics v12.3.6
           - WP User Avatar v2.0.9
           - wpForo v1.4.9
           - YouTube v11.8.6.1
WordPress Database Charset utf8mb4
WordPress Database Collate 
Publisher Version          2.8.0.build524
Web Player Version         player_v4
Twig Version               1.35.3
open_basedir               ok
curl Version               7.47.0
iconv                      available
simplexml                  ok
max_execution_time         30
upload_max_filesize        64M
memory_limit               256M
disable_classes            
disable_functions          pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
permalinks                 ok (/%postname%/)
podlove_permalinks         ok
podcast_settings           ok
web_player                 ok
podlove_cache              on
assets                     
  - mp3    audio/mpeg       https://serienrepublik.de/feed/mp3/
  - m4a    audio/mp4        https://serienrepublik.de/feed/m4a/
cron                       ok

0 errors
0 notices
Nice, Everything looks fine!

Als Slug verwende ich in den Episoden (z. B. Frell-002.mp3/.m4a):

17

Sorry, ich weiss, ich bin nervig. Ich geringschätze damit eure Arbeit nicht. Ich habe ein hohes Maß an Respekt dafür, dass ihr eure Freizeit opfert um uns so ein tolles Tool hinzustellen. Bitte sieh meine Probleme daher als konstruktives Feedback an. :slight_smile:

VG
Tim

P. S.: Der neue Selektionscode hat auch mit “Frellpod” für Show nicht funktioniert.

Show-Slug, nicht Titel. Groß- und Kleinschreibung beachten.

{% for episode in podcast.episodes({show: "frellpod"}) %}

@ericteubert hat den Fehler gefunden, jetzt funktioniert die Filterung endlich! Vielen Dank.