<?php
get_header();
?>

<main>

  <section class="background-color-white category">
    <div class="content-wrap">
      <h2>
        <?php $categories = get_the_category();
        if ( ! empty( $categories ) ) {
            echo esc_html( $categories[0]->name );
        } ?>
      </h2>

      <div class="tx-indexedsearch">

        <div class="tx-indexedsearch-browsebox">
  				<p>
            <?php
              global $wp_query;
              $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
              $post_count_start = (($paged -1) * 10) + 1;
              $post_count_end = ((($paged -1) * 10) + $wp_query->post_count);
              _e("Showing results", 'kit');
              echo "<strong> ";
              printf( esc_html__( '%d to %d', 'kit' ), $post_count_start, $post_count_end );
              echo "</strong> ";
              _e("from total results", 'kit');
              echo " <strong>" . $wp_query->found_posts. "</strong>";
            ?>
  				</p>
          <div class="tx-indexedsearch-browsebox">
            <?php the_posts_pagination( array(
                'mid_size'  => 2,
                'prev_text' => __( '< Previous', 'kit' ),
                'next_text' => __( 'Next >', 'kit' ),
                'type' => 'list',
                'before_page_number' => __('Page ', 'kit')
            ) ); ?>
          </div>
        </div>

      </div>

        <div class="container container-3-cols">

          <?php
          if ( have_posts() ) :
            while ( have_posts() ) :

              the_post();
              ?>
              <div class="column">
              <div class="teaser-box teaser-box-color-brand-secondary" id="c959">
                <?php echo '<a href="' . esc_url( get_permalink() ) . '">'; ?>
                  <figure class="teaser-box-image">
                    <?php if ( has_post_thumbnail() ) { ?>
                    <img src="<?php echo get_the_post_thumbnail_url(); ?>">
                    <?php } else {
                      $custom_logo_id = get_theme_mod( 'kit_defaultimage' );
                      $logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
                    ?>
                    <img src="<?php echo esc_url( $logo[0] ); ?>">
                    <?php } ?>
                  </figure>
                </a>
                <?php echo '<a href="' . esc_url( get_permalink() ) . '">'; ?>
                  <h3>
                    <?php echo esc_html( get_the_title() ); ?>
                  </h3>
                </a>
                <p>
                  <?php echo wp_strip_all_tags( get_the_excerpt(), true ); ?>
                </p>
                <?php echo '<a href="' . esc_url( get_permalink() ) . '" class="teaser-box-category-marker">'; ?>
                  Zum Beitrag
                  <div class="icon"></div>
                </a>
              </div>
              </div>
<?php
            endwhile;
            wp_reset_postdata();
          endif;
          ?>

          </div>

          <div class="tx-indexedsearch">
            <div class="tx-indexedsearch-browsebox">
              <?php the_posts_pagination( array(
                  'mid_size'  => 2,
                  'prev_text' => __( '< Previous', 'kit' ),
                  'next_text' => __( 'Next >', 'kit' ),
                  'type' => 'list',
                  'before_page_number' => __('Page ', 'kit')
              ) ); ?>
            </div>
          </div>

    </div>
  </section>

</main>





<?php

  get_template_part('template-parts/sidebar');
  get_footer();
