<main class="page">
<div class="affiche">
<div class="affiche__container _container">
<div class="affiche__title title_h2">
<?php single_term_title(); ?>
</div>
<nav class="affiche__menu">
<?php
$current_cat = get_queried_object();
$args = array(
'child_of' => $current_cat->term_id,
'taxonomy' => $current_cat->taxonomy,
);
$categories = get_categories($args);
?>
<ul class="affiche__menu-list">
<?php
if ($categories) {
foreach ($categories as $category) {
echo '<li>';
echo '<a href="' . get_category_link($category->term_id) . '">' . $category->name . '</a>';
echo '</li>';
}
}
?>
</ul>
</nav>
<div class="affiche__body carts affiche-carts">
<?php
$mainquery = get_queried_object();
$mypost_Query = new WP_Query(array(
'tax_query' => array(
array(
'taxonomy' => $mainquery->taxonomy,
'field' => 'slug',
'terms' => $mainquery->slug
)
),
'post_status' => 'publish',
'posts_per_page' => 12,
'order' => 'DESC'
));
if ($mypost_Query->have_posts()) {
while ($mypost_Query->have_posts()) {
$mypost_Query->the_post();
get_template_part('./inc/loop-category');
}
} else {
get_template_part('template-parts/content', 'none');
}
wp_reset_postdata();
?>
</div>
<?php if ($mypost_Query->max_num_pages > 1) { ?>
<script>
var this_page = 1;
</script>
<div title="Еще записи" class="btn-loadmore affiche__btn button__green button" data-param-posts='<?php echo serialize($mypost_Query->query_vars); ?>' data-max-pages='<?php echo $mypost_Query->max_num_pages; ?>' data-tpl='posts'>Еще записи</div>
<?php } ?>
</div>
</div>
</main>