<?php
get_header();
$term = get_queried_object();
?>
<main class="index-php">
<section class="archive-page section section--pt-0">
<div class="container archive-page__container">
<div class="archive-page-content">
<div class="archive-page-content__header mb-32">
<div class="search-result-header">
<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 get_search_form(); ?>
</div>
<div class="archive-posts">
<?php
if (have_posts()) :
while (have_posts()) :
the_post();
get_template_part( 'includes/post/post' );
endwhile;
the_posts_pagination();
else :
// Если постов нет
?>
<p class="archive-page__no-result"><?php esc_html_e('Sorry, no posts were found.', 'your-text-domain'); ?></p>
<?php
endif;
?>
</div>
</div>
<aside class="archive-page-sidebar">
<div class="page-subtitle mb-32">Categories</div>
<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>
<?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>';
}
?>
</aside>
</div>
</section>
<?php get_template_part( 'includes/increase-efficiency' ); ?>
<?php get_template_part( 'includes/get-started' ); ?>
</main>
<?php get_footer(); ?>