<?php get_header(); ?>
<main class="single-page">
<div class="container">
<a href="/blog/" class="archive-page__back mb-16">
<img class="search-result-header__arrow" src="/wp-content/uploads/2023/11/left-arrow.svg" alt="" width="800" height="800">
Back to Catalogue
</a>
<div class="single-page-inner">
<div class="single-content content">
<div class="section-subtitle section-subtitle--dark-blue single-title mb-16"><?php the_title(); ?></div>
<div class="single-subheader mb-32">
<div class="d-flex ai-c gap-20">
<div class="archive-post-blog-image-wrap">
<img src="/wp-content/uploads/2023/11/blog-icon.svg" alt="" class="archive-post__image" width="24" height="24">
Blog
</div>
<div class="d-flex">
<time class="archive-post-date" datetime="<?php the_time('Y-m-d'); ?>"><?php the_time('d M Y'); ?></time>
<div class="archive-post-read">
<?php
$post_content = get_the_content();
echo read_time_estimate($post_content);
?>
</div>
</div>
</div>
<?php
$categories = get_the_category();
if ($categories) :?>
<div class="archive-post-category d-flex ai-fs gap-8">
<!-- <a href="/blog/" class="lh-1">-->
<!-- <img class="archive-post-category__image" width="36" height="28" src="/wp-content/uploads/2023/11/fire-icon.svg" alt="">-->
<!-- </a>-->
<?php foreach ($categories as $category) {
echo '<a class="archive-post-category__link" href="' . esc_url(get_category_link($category->term_id)) . '">' . esc_html($category->name) . '</a>';
} ?>
</div>
<?php endif; ?>
</div>
<div class="single-poster mb-32">
<!-- <div class="single-poster__header mb-24">-->
<!-- <a class="single-poster-logo">-->
<!-- <img width="141" height="40" src="/wp-content/uploads/2023/11/precis-logo-dark.svg" alt="précis ai logo" class="single-poster__logo">-->
<!-- </a>-->
<!-- </div>-->
<?php if(get_field('post_author_block_name')): ?>
<div class="single-poster__author mb-16"><?php the_field('post_author_block_name'); ?></div>
<?php endif; ?>
<div class="single-poster__body">
<?php
$post_single_image = get_field('post_single_image');
if( !empty($post_single_image) ): ?>
<img class="single-image" width="<?php echo $post_single_image['width']; ?>" height="<?php echo $post_single_image['height']; ?>" src="<?php echo $post_single_image['url']; ?>" alt="<?php echo $post_single_image['alt']; ?>">
<?php elseif (get_the_post_thumbnail_url()) :
$image_id = get_post_thumbnail_id();
$image_alt = get_post_meta($image_id, '_wp_attachment_image_alt', TRUE);
?>
<img class="single-image" src="<?php echo get_the_post_thumbnail_url(); ?>" alt="<?php echo $image_alt; ?>">
<?php else: ?>
<img class="single-image" src="<?php echo home_url().'/wp-content/uploads/2020/05/bg-1.jpg'?>" alt="">
<?php endif; ?>
<!-- <div class="single-poster-logo-vertical__wrap">-->
<!-- <div class="single-poster-logo-vertical">precisai.com</div>-->
<!-- </div>-->
</div>
</div>
<?php while ( have_posts() ) : the_post();
the_content();
endwhile; ?>
<?php if(get_field('post_author_block_is_display')): ?>
<div class="single-content-signature">
<?php $post_author_block_photo = get_field('post_author_block_photo');
if( !empty($post_author_block_photo) ): ?>
<img class="single-content-signature__image" width="<?php echo $post_author_block_photo['width']; ?>" height="<?php echo $post_author_block_photo['height']; ?>" src="<?php echo $post_author_block_photo['url']; ?>" alt="<?php echo $post_author_block_photo['alt']; ?>">
<?php endif; ?>
<!-- <img width="100" height="101" src="/wp-content/uploads/2023/11/chris-fisccus.jpg" alt="" class="single-content-signature__image">-->
<div class="single-content-signature__title">
<?php the_field('post_author_block_name'); ?>
</div>
<div class="single-content-signature__bottom">
<?php if(get_field('post_author_block_email')): ?>
<a href="mailto:<?php the_field('post_author_block_email'); ?>" class="single-content-signature__email d-block mb-8"><?php the_field('post_author_block_email'); ?></a>
<?php endif; ?>
<?php if(get_field('post_author_block_phone')):
$tel_text = get_field('post_author_block_phone');
$parttern = '/[^+0-9]/';
$tel = preg_replace($parttern, '', $tel_text);
?>
<?php endif; ?>
<a href="tel:<?php echo $tel; ?>" class="single-content-signature__phone d-block"><?php echo $tel_text; ?></a>
</div>
</div>
<?php endif; ?>
</div>
<div class="single-sidebar">
<div class="page-subtitle">History</div>
<?php
$args = array(
'posts_per_page' => 3,
);
$query = new WP_Query($args);
if ($query->have_posts()) :
while ($query->have_posts()) : $query->the_post();
get_template_part( 'includes/post/post' );
endwhile;
// Сброс данных поста
wp_reset_postdata();
else : ?>
<div class="archive-page__no-result"><?php esc_html_e('Sorry, no posts were found.', 'your-text-domain'); ?></div>
<?php endif;
?>
</div>
</div>
</div>
<?php get_template_part( 'includes/increase-efficiency' ); ?>
<?php //get_template_part( 'includes/get-started' ); ?>
</main>
<?php get_footer(); ?>