<?php
/**
 * The template for displaying podcast archive pages
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package podcastin
 */

get_header();
?>
<div id="content">
    <div class="episode-header page-section">
        <div class="container">
            <div class="row">
                <div class="col-md-7">
                    <div class="categories-single">
                        <?php 

                        $category = get_the_terms( $post->ID, 'series' ); 
                        if( $category){      
                        foreach ( $category as $cat){ ?>
                        
                        <a class="category-item" href="<?php echo esc_url( get_term_link( $cat ) ) ?>">
                                    <?php echo $cat->name; ?>
                                </a>
                        <?php }}
                        ?>
                    </div>
                    <header class="entry-header">
                        <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
                       
                    </header>
                     <?php echo do_shortcode('[ss_player]'); ?>
                </div>

                <div class="col-md-5">
                    <?php podcastin_post_thumbnail('full'); ?>
                </div>

            </div>        
        </div>
    </div>


    <div class="episode-content page-section">
        <div class="container">
            <div class="row">
                <div class="col-md-7">
                    <?php the_content();

                        the_post_navigation(
                            array(
                                'prev_text' => '<span class="nav-subtitle">' . esc_html__( 'Previous:', 'podcastin' ) . '</span> <span class="nav-title">%title</span>',
                                'next_text' => '<span class="nav-subtitle">' . esc_html__( 'Next:', 'podcastin' ) . '</span> <span class="nav-title">%title</span>',
                            )
                        );

                    // If comments are open or we have at least one comment, load up the comment template.
                        if ( comments_open() || get_comments_number() ) :
                            comments_template();
                        endif;
                        ?>


                </div>

                <div class="col-md-5">
                    <div class="single-ep-widget">
                        <h2 class="single-episode-widget"><?php esc_html_e("Series Playlist", "podcastin") ?></h2>

                        <?php echo do_shortcode("[podcast_playlist player_style='compact' series=\"$cat->name\"]") ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php
get_footer();