<?php
/**
 * Template Name: Prosta strona
 * Template Post Type: post, page
 *
 * @link https://krzysztof-turek.com
 *
 * @package tylkofotografia.pl
 * @version 0.1
 */
get_header();
global $post;
global $wpdb;

$upload_dir = wp_upload_dir();

$image = $wpdb->get_row(
    "SELECT * FROM {$wpdb->prefix}responsive_images where  `img_filetype` in ('jpg', 'png') and `img_size` = 'hr' and `img_post_id` = " .
        get_post_thumbnail_id($post->ID),
);
$webp = $wpdb->get_row(
    "SELECT * FROM {$wpdb->prefix}responsive_images where  `img_filetype` in ('webp') and `img_size` = 'hr' and `img_post_id` = " .
        get_post_thumbnail_id($post->ID),
);

if (!empty($image)) {
    $time = filemtime($upload_dir["basedir"] . $image->img_location);
}
if (!empty($webp)) {
    $webpset =
        '"' .
        $upload_dir["baseurl"] .
        $image->img_location .
        '" type("image/webp"), ';
} else {
    $webpset = "";
}
?>
 <?php
 if (have_posts()):
     while (have_posts()):
         the_post(); ?>
	<div class="page-hero" style='background-image: linear-gradient(0deg, rgba(28,47,64,0.7),rgba(47,72,103,0.7)), url("<?php echo $upload_dir[
     "baseurl"
 ] .
     $webp->img_location; ?>?x=<?php echo $time; ?>");  background-repeat: no-repeat; background-position: top; background-size: cover; height:585px
		'>
		<div class="container col-lg-8 col-xs-12">
		<div class="row" style="color:#fff">
		<div style="padding-top: calc(18% + 190px)">
<h1 class="post-title text-center mb-5" ><?php the_title(); ?></h1>
		<?php the_excerpt(); ?>
		<?php get_template_part("template-parts/content/content-meta"); ?>
				</div>
			</div>
		</div>

</div>
<article class="container col-lg-8 col-xs-12 test4">
		<div class="row">
			<div class="offset-lg-2 col-lg-8 col-xs-12">

			<nav id="breadcrumbs" class="breadcrumbs mb-5"><?php echo Breadcrumbs::postBreadcrumbs(); ?></nav>

<?php the_content(); ?>
</div>

	</div>
	</article>

<?php
     endwhile;
 else:
     get_template_part("template-parts/content/content-none");
 endif;

 comments_template();
 get_footer();

