/home/bdqbpbxa/dev-subdomains/precisai-dev.goodface.com.ua/wp-content/themes/precisai/index.php
<?php
get_header();
if (is_home() || is_search()):
?>
<main class="index-php">
<section class="archive-page section section--pt-0 section-pb-md">
<div class="container archive-page__header">
<div class="archive-page-content__header">
<?php if (is_search()): ?>
<div class="d-flex gap-32">
<a href="/blog/" class="archive-page__back">
<img class="search-result-header__arrow"
src="/wp-content/uploads/2023/11/left-arrow.svg" alt="" width="800" height="800">
Back to Catalogue
</a>
<h1 class="page-subtitle">Search results</h1>
</div>
<?php else: ?>
<h1 class="page-subtitle">Latest Articles</h1>
<?php endif; ?>
<?php get_search_form(); ?>
</div>
<!--<div class="page-subtitle archive-page-categories">Categories</div>-->
</div>
<div class="container archive-page__container">
<div class="archive-page-content">
<div class="archive-posts">
<?php
if (have_posts()) :
while (have_posts()) :
the_post();
get_template_part('includes/post/post');
endwhile;
?>
<?php
else :
// Если постов нет
?>
<div class="archive-page__no-result"><?php esc_html_e('Sorry, no posts were found.', 'your-text-domain'); ?></div>
<?php
endif;
?>
</div>
<div class="pagination-wrap mt-40">
<?php
global $wp_query;
$total_pages = $wp_query->max_num_pages;
$current_page = max(1, get_query_var('paged'));
?>
<div data-max-page="<?php echo $total_pages; ?>" data-curr-page="<?php echo $current_page; ?>"
class="pagination">
<?php if ($current_page === 1) : ?>
<div class="prev page-numbers page-numbers--disabled">
<svg width="9" height="15" fill="none" xmlns="http://www.w3.org/2000/svg">
<path opacity=".8"
d="M.197 7.102L7.08.164c.22-.22.576-.22.796 0l.929.928c.22.22.22.577 0 .797L3.249 7.5l5.555 5.61c.22.221.22.578 0 .798l-.929.928a.563.563 0 01-.796 0L.197 7.898a.563.563 0 010-.796z"
fill="#777"></path>
</svg>
</div>
<?php endif; ?>
<?php echo paginate_links(array(
'total' => $total_pages,
'prev_text' => '<svg width="9" height="15" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity=".8" d="M.197 7.102L7.08.164c.22-.22.576-.22.796 0l.929.928c.22.22.22.577 0 .797L3.249 7.5l5.555 5.61c.22.221.22.578 0 .798l-.929.928a.563.563 0 01-.796 0L.197 7.898a.563.563 0 010-.796z" fill="#777"></path></svg>',
'next_text' => '<svg width="9" height="15" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity=".8" d="M8.803 7.898l-6.881 6.938a.563.563 0 01-.797 0l-.928-.928a.563.563 0 010-.797L5.752 7.5.197 1.89a.563.563 0 010-.798l.928-.928c.22-.22.577-.22.797 0l6.881 6.938c.22.22.22.576 0 .796z" fill="#777"></path></svg>',
)); ?>
<?php if ($current_page === $total_pages): ?>
<div class="next page-numbers page-numbers--disabled">
<svg width="9" height="15" fill="none" xmlns="http://www.w3.org/2000/svg">
<path opacity=".8"
d="M8.803 7.898l-6.881 6.938a.563.563 0 01-.797 0l-.928-.928a.563.563 0 010-.797L5.752 7.5.197 1.89a.563.563 0 010-.798l.928-.928c.22-.22.577-.22.797 0l6.881 6.938c.22.22.22.576 0 .796z"
fill="#777"></path>
</svg>
</div>
<?php endif; ?>
</div>
</div>
</div>
<aside class="archive-page-sidebar">
<div class="archive-page-sidebar__item with-form mb-32">
<?php
$title = get_field('title', 'option');
if ($title): ?>
<div class="form-title"><?php echo esc_html($title); ?></div>
<?php endif; ?>
<?php
$text = get_field('text', 'option');
if ($text): ?>
<div class="form-text"><?php echo esc_html($text); ?></div>
<?php endif; ?>
<?php
$form = get_field('form', 'option');
if ($form) :
$contact_form = WPCF7_ContactForm::get_instance($form);
$cf7_shortcode_with_id = str_replace(']', ' html_class="form "]', $contact_form->shortcode());
$cf7_form = do_shortcode($cf7_shortcode_with_id);
?>
<?php echo $cf7_form; ?>
<?php endif; ?>
</div>
<div class="page-subtitle archive-page-categories mb-24">Categories</div>
<div class="archive-page-sidebar__item mb-32">
<!-- <div class="archive-page-sidebar-title">-->
<!-- <img src="/wp-content/uploads/2023/11/latest-articles-icons.svg" alt="latest articles icon" width="24" height="24">-->
<!-- Latest Articles-->
<!-- </div>-->
<a href="https://precisai.com/glossary-term/"
class="archive-page-sidebar__category">Glossary</a>
<?php
$args = array(
'taxonomy' => 'category',
'hide_empty' => 1, // Исключаем пустые категории
);
$categories = get_categories($args);
foreach ($categories as $category) {
echo '<a class="archive-page-sidebar__category" href="' . get_category_link($category->term_id) . '">' . $category->name . '</a>';
}
?>
</div>
<!--<div class="archive-page-sidebar__item">
<div class="archive-page-sidebar-title archive-page-sidebar-title__media-contact mb-8"><?php the_field('media_contact_title', 'option') ?></div>
<div class="archive-page-sidebar-title mb-8"><?php the_field('media_contact_name', 'option') ?></div>
<?php $media_contact_image = get_field('media_contact_image', 'option');
if (!empty($media_contact_image)): ?>
<img class="archive-page-sidebar__image mb-24" width="<?php echo $media_contact_image['width']; ?>" height="<?php echo $media_contact_image['height']; ?>" src="<?php echo $media_contact_image['url']; ?>" alt="<?php echo $media_contact_image['alt']; ?>">
<?php endif; ?>
<div class="archive-page-sidebar-text lh-16 mb-24"><?php the_field('media_contact_text', 'option') ?></div>
<?php echo do_shortcode('[contact-form-7 id="f714b3b" title="Sidebar Contact Form"]'); ?>
</div>-->
</aside>
</div>
</section>
<?php get_template_part('includes/increase-efficiency'); ?>
</main>
<?php
else:
?>
<main class="index-php"><h1 class="title"><?php echo get_the_title(); ?></h1>
<div class="container">
<div class="title"><?php the_title(); ?></div>
<div class="content">
<?php while (have_posts()) : the_post();
the_content();
endwhile; ?>
</div>
</div>
</main>
<?php
endif;
get_footer();
?>