Shortcode vs Template Tags


My landing page used to show the subtitle of the latest show:

<?php echo do_shortcode('[podlove-episode field="subtitle"]'); ?>

After one of the latest updates it doesn´t work anymore.

How do I use template tags to show the subtitle of the latest show again?



The corresponding template tag to [podlove-episode field="subtitle"] is {{ episode.subtitle }}, so maybe just replacing that does the trick. I’m not familiar with wrapping it in this PHP code, though.

Hope this helps.

Thanks - but no :wink: Doesn´t help.

Hm… now shows [podcast.subtitle] to the template engine itself seems to work. But where do the square brackets come from? I think they are the deal breaker here. Can you maybe post your entire template code here?

Right now shows {{ episode.summary }}.

The whole code of the landing-page is:

Template Name: Landing Page

<?php get_header(); ?>
<?php if ( have_posts() ) the_post(); ?>
  <section id="landing-info">
    <?php the_content(); ?>

    <ul id="show-list" class="landing">
      $shows = get_blogs_of_user(1);
      // print_r($shows);
      global $post;
      $args = array(
        'numberposts' => 1,
        'post_type' => 'podcast' );

      foreach ($shows as $show) {
        $episodes = get_posts( $args );
        foreach ($episodes as $post ) {
	        <li class="<?php echo str_replace('/','',$show->path); ?>">
	          <div class="show-head">
	            <a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>">
	              <h2><?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?></h2>
	              <img src="<?php header_image(); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" />
              <div class="player-small">
                <?php // echo do_shortcode('[podlove-web-player]'); ?>
	          <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
	          <?php echo do_shortcode(' {{ episode.summary }} '); ?>

<?php get_footer(); ?>

OK, thanks. @ericteubert: I’m at the end of my knowledge & intuition here, sorry.

There’s no official way yet to access Publisher data from within themes, but this will work here:

$episode = \Podlove\Model\Episode::find_one_by_post_id(get_the_ID());
echo $episode->summary;
1 Like

Great. Works. I only changed





This whole podcast overview page could be done much simpler with a single Podlove Template that would need no theme support or PHP intervention at all.

This is not a complete instruction, just from the top of my head and untested:

First create a list of podcasts named “kuechenstudio” in Network -> Lists. and add all relevant podcasts to it.

Then create a template named “kuechenhome” in Network -> Templates with the following contents:

  {% for podcast in network.lists({id: "kuechenstudio"}).podcasts %}
    <a href="{{ podcast.landingPageUrl }}" title="{{ podcast.title }}">
      {{ podcast.image.html({ width: icon_size }) }}
    <div class="player-small"/>
    {% for episode in podcast({ limit: 1 }) %}
        <a href="{{ episode.url }}">
          {{ episode.title  }}
      {{ episode.subtitle  }}          
    {% endfor %}
  {% endfor %}

Then put this shortcode into the page that is representing the home page:

[podlove-template template="kuechenhome"]

This should more or less do what you are doing now.