<?php
/**
* The main template file
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* e.g., it puts together the home page when no home.php file exists.
*
* Learn more: {@link https://codex.wordpress.org/Template_Hierarchy}
*
* @package Biofriction
* @since Biofriction 1.0.0
*/

get_header(); ?>

<div class="main-container">
	<div class="main-grid">
		<main class="main-content">
			<div class="bfr_category_archive">
				<?php if ( have_posts() ) : ?>
					<?php // Start the Loop  ?>
					<?php while ( have_posts() ) : the_post(); ?>
						<article id="post-<?php the_ID(); ?>" <?php post_class('bfr_post'); ?>>
							<div class="bfr_post_content">
								<header>
									<h2 class="entry-title">
										<a href="<?php the_permalink(); ?>" rel="bookmark">
											<?php the_title(); ?>
										</a>
									</h2>
								</header>
								<div class="bfr_post_thumbnail">
									<?php if ( has_post_thumbnail() ) :?>
										<img src="<?php echo get_the_post_thumbnail_url();?>" />
									<?php else :?>
										<img src="<?php echo catch_post_first_image();?>" />
									<?php endif;?>
								</div>
								<footer>
									<div class="excerpt post-excerpt">
										<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"></a>
										<?php echo wp_strip_all_tags( get_the_excerpt(), true ); ?>
									</div>
									<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>" class="button">
										Read more
									</a>
								</footer>
							</div>
						</article>
					<?php endwhile; // End loop. ?>
					<?php wp_reset_postdata(); ?>
				</div>
				<?php get_template_part( 'template-parts/navigation', 'prevnext' ); ?>
			<?php else : ?>
				<?php get_template_part( 'template-parts/content', 'none' ); ?>
			<?php endif; // End have_posts. ?>
		</main>
	</div>
</div>
<?php get_footer();