67 lines
2.2 KiB
PHP
67 lines
2.2 KiB
PHP
<?php
|
|
|
|
// Архивы: рубрики, теги, даты, поиск
|
|
|
|
if (! defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
get_header();
|
|
|
|
$archive_title = '';
|
|
$archive_intro = '';
|
|
|
|
if (is_home()) {
|
|
$blog_id = (int) get_option('page_for_posts');
|
|
$archive_title = $blog_id ? (string) get_the_title($blog_id) : 'Статьи';
|
|
$archive_intro = $blog_id ? trim((string) get_post_field('post_content', $blog_id)) : '';
|
|
} else {
|
|
$archive_title = wp_strip_all_tags((string) get_the_archive_title());
|
|
}
|
|
if ('' === trim($archive_title)) {
|
|
$archive_title = 'Статьи';
|
|
}
|
|
?>
|
|
<main class="page page-blog">
|
|
<section class="bento blog-section" aria-label="<?php echo esc_attr($archive_title); ?>">
|
|
<div class="bento__full section-header--left">
|
|
<span class="bento-label">Статьи</span>
|
|
<h1 class="bento-h2"><?php echo esc_html($archive_title); ?></h1>
|
|
<?php if ('' !== $archive_intro) : ?>
|
|
<div class="pksh-lead pksh-section__text"><?php echo wp_kses_post(wpautop($archive_intro)); ?></div>
|
|
<?php else : ?>
|
|
<?php the_archive_description('<div class="pksh-lead pksh-section__text">', '</div>'); ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<div class="bento__full">
|
|
<?php if (have_posts()) : ?>
|
|
<div class="blog-grid">
|
|
<?php
|
|
while (have_posts()) :
|
|
the_post();
|
|
get_template_part('template-parts/blog/card');
|
|
endwhile;
|
|
?>
|
|
</div>
|
|
<?php
|
|
$links = paginate_links(array(
|
|
'total' => max(1, (int) $GLOBALS['wp_query']->max_num_pages),
|
|
'current' => max(1, (int) get_query_var('paged')),
|
|
'type' => 'plain',
|
|
));
|
|
if ($links) :
|
|
?>
|
|
<nav class="blog-pagination" aria-label="Пагинация записей"><?php echo wp_kses_post($links); ?></nav>
|
|
<?php
|
|
endif;
|
|
?>
|
|
<?php else : ?>
|
|
<p class="pksh-lead">Ничего не найдено.</p>
|
|
<?php endif; ?>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
<?php
|
|
get_footer();
|