<?php
/**
 * Post single page
 *
 */
inoby_enqueue_parted_style("post", "post_types");
inoby_enqueue_parted_script("post", "post_types");

// get categories
$categories = get_the_category($post->ID);

get_header();
?>

<main id="primary" class="site-main">
  <section class="header">
    <div class="container">
      <div class="thumbnail-wrapper">
        <?php $url = get_the_post_thumbnail_url($post); ?>
        <?php if ($url): ?>
          <img class="thumbnail" src="<?= $url ?>" alt="<?= get_the_title($post) ?>">
        <?php else: ?>
          <img class="thumbnail default" src="<?= get_theme_file_uri("assets/svg/logo.svg") ?>" alt="<?= get_the_title($post) ?>">
        <?php endif; ?>
        <div class="overlay"></div>
        <h2 class="title">
          <?php the_title(); ?>
        </h2>
      </div>
    </div>
  </section>

  <section class="info">
    <div class="container">
      <div class="info-wrapper">
        <?php foreach ($categories as $category): ?>
            <span class="category">
              <?= $category->name ?>
            </span>
          <?php endforeach; ?>
        <time class="date" datetime="<?= get_the_time("Y-m-d H:i:s", $post) ?>">
          <?= get_the_time("d.m.Y", $post) ?>
        </time>
      </div>
    </div>
  </section>

  <section class="content">
    <div class="container">
      <?php the_content(); ?>
    </div>
  </section>
</main>

<?php get_footer();
