<?php get_header(); ?> <!-- ouvrir header,php -->
<main>
    <?php kspace_cat_breadcrumb(single_cat_title('', false), 'book'); ?>

    <img class="cover" src="<?php
    $term_meta = get_option( "taxonomy_term_$tag_id" );
    echo $term_meta['cover'];
     ?>">
		<div class="roman">
	    <div class="card">
				<h1><?php echo single_cat_title(); ?></h1>
				<div class="card-body">
					<?php echo tag_description();?>
				</div>
	    </div>

      <?php
        $args = array(
        'tax_query' => array(
            array(
            'taxonomy' => 'roman',
            'field' => 'term_id',
            'terms' => $tag_id // you need to know the term_id of your term "example 1"
            ),
          ),
        'posts_per_page' => -1,
        'order' => 'ASC',
        );
        $query = new WP_Query( $args );
      ?>

			<div class="card card-primary">
			  <div class="card-header"><i class="fa fa-list" aria-hidden="true"></i> Chapitres</div>
			  <div class="card-menu">
          <?php if($query->have_posts()) : ?>
            <?php $i = 1; ?>
              <?php while($query->have_posts()) : $query->the_post(); ?>
                 <a href="<?php the_permalink(); ?>" class="menu-element">
                   <span class="text-dark">
                     <strong>Chapitre <?php echo $i++; ?>.</strong>
                     <?php the_title(); ?>
                   </span>
                   <span>
                     <em class="text-dark"><?php the_time('d/m/Y') ?></em>
                   </span>
                 </a>
              <?php endwhile; ?>
          <?php endif; ?>
			  </div>
			</div>

		</div>
</main>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
