Files
tylkofotografia/page-contact.php
2026-01-15 12:23:11 +01:00

136 lines
3.4 KiB
PHP

<?php
/**
* Template Name: Formularz kontaktowy
* 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 (wp_is_mobile()) {
$image = $wpdb->get_row(
"SELECT * FROM {$wpdb->prefix}responsive_images where `img_filetype` in ('jpg', 'png') and `img_size` = 'hrmb' 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` = 'hrmb' 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 = "";
}
if (!empty($image)) {
$jpgpset =
'"' .
$upload_dir["baseurl"] .
$image->img_location .
'" type("image/jpg")'; ?>
<?php if (have_posts()):
while (have_posts()):
the_post(); ?>
<?php if (!wp_is_mobile()) { ?>
<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-6 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(); ?>
<p></p>
</div>
</div>
</div>
</div>
<article class="container col-lg-8 col-xs-12 test4">
<?php } else { ?>
<div >
<div class="img-container" style='margin-top: 70px;'>
<figure class="wp-caption image">
<picture>
<source srcset="<?php echo $upload_dir["baseurl"] .
webp->img_location; ?>?x=<?php echo $time; ?>" type="image/webp">
<source srcset="<?php echo $upload_dir["baseurl"] .
$image->img_location; ?>?x=<?php echo $time; ?>" type="image/jpeg">
<img src="<?php echo $upload_dir["baseurl"] .
$image->img_location; ?>?x=<?php echo $time; ?>">
</picture>
</figure>
<div class="overlay">
<div class="text">
<div style="padding-top: 0px">
<h1 class="post-title text-center mb-5" ><?php the_title(); ?></h1>
<?php the_excerpt(); ?>
<p></p>
</div>
</div>
</div>
</div>
</div>
<article class="container col-lg-8 col-xs-12 test4">
<?php } ?>
<div class="row">
<div class="offset-lg-2 col-lg-8 col-xs-12">
<?php the_content(); ?>
</div>
</div>
</article>
<?php
endwhile;
else:
get_template_part("template-parts/content/content-none");
endif;
}
?>
<?php
comments_template();
get_footer();