<?php

/**
 * Single Tag Page.
 *
 * @link    https://aiopodcasting.com
 * @since   1.0.0
 *
 * @package AiO_Podcast_Studio
 */

// Exit if accessed directly
if ( ! defined( 'WPINC' ) ) {
	die;
}
?>
<div class="aiopod aiopod-single aiopod-single--tag">
    <?php 
    if ( ! empty( $attributes['show_breadcrumbs'] ) ) {
        aiopod_the_taxonomy_breadcrumbs( $term, 'aiopod_categories', $attributes['current_page_id'] );
    }

    echo '<div class="aiopod-tag">';

    // Description
    if ( ! empty( $term->description ) ) {
        echo '<div class="aiopod-tag__description">';
        echo wp_kses_post( wpautop( $term->description ) );
        echo '</div>';
    }

    // Episodes
    if ( ! empty( $attributes['show_episodes'] ) ) {
        $episodes_args = array( 
            'tags'  => $term->term_id,
            'title' => $attributes['episodes_title']
        );

        $episodes_args = apply_filters( 'aiopod_single_tag_episodes_args', $episodes_args );
        aiopod_the_episodes( $episodes_args );
    } 

    echo '</div>';
    ?>  
</div>