corect archiv
This commit is contained in:
@@ -26,11 +26,15 @@ if( $posts ):
|
||||
<?if (LANG_VERSION == 'ru'):?>
|
||||
<div class="right_archive_link"><a href="<?php the_permalink(); ?>"><?=the_title();?></a></div>
|
||||
<?endif?>
|
||||
<br>
|
||||
<center class="left_center_block">
|
||||
<a href="https://vetandlife.ru/category/arkhiv/" class="left_button" target="_blank">Архив номеров</a>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
|
||||
<?php endforeach;
|
||||
|
||||
wp_reset_postdata();
|
||||
wp_reset_postdata();?>
|
||||
|
||||
endif;
|
||||
<?php endif;
|
||||
|
||||
@@ -33,6 +33,17 @@ get_header();?>
|
||||
$page = get_query_var('paged');
|
||||
$curryear = date('Y');
|
||||
|
||||
$year_params = [
|
||||
|
||||
'posts_per_page' => -1 ,
|
||||
'category' => 3, // 19 - архив газеты,
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC',
|
||||
'post_type' => 'post',
|
||||
'suppress_filters' => true
|
||||
|
||||
];
|
||||
|
||||
if ($page == 0) {
|
||||
$page = 1;
|
||||
$numbers_year = $curryear;
|
||||
@@ -42,15 +53,21 @@ else {
|
||||
}
|
||||
|
||||
|
||||
$posts = get_posts( array(
|
||||
'posts_per_page' => -1 ,
|
||||
'category' => 3, // 19 - архив газеты,
|
||||
'year' => $numbers_year,
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC',
|
||||
'post_type' => 'post',
|
||||
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
|
||||
) );
|
||||
$curr_params = $year_params;
|
||||
$curr_params['year'] = $numbers_year;
|
||||
|
||||
$posts = get_posts($curr_params);
|
||||
|
||||
if (count($posts) == 0){
|
||||
|
||||
$numbers_year = $numbers_year - 1;
|
||||
|
||||
$curr_params = $year_params;
|
||||
$curr_params['year'] = $numbers_year;
|
||||
|
||||
$posts = get_posts($curr_params);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -86,6 +103,13 @@ $posts = get_posts( array(
|
||||
|
||||
</div> <!--//end minicard block -->
|
||||
|
||||
|
||||
|
||||
<?//get_template_part( '/blocks/paginator');?>
|
||||
|
||||
<?endif?>
|
||||
|
||||
|
||||
<div class="pagination-wrapper">
|
||||
<nav class="navigation pagination" role="navigation" aria-label="Записи">
|
||||
<div class="nav-links">
|
||||
@@ -103,17 +127,11 @@ $posts = get_posts( array(
|
||||
<?endfor?>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<?//get_template_part( '/blocks/paginator');?>
|
||||
|
||||
<?endif?>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -120,9 +120,6 @@
|
||||
</div>
|
||||
</div><!-- end main -->
|
||||
|
||||
|
||||
<footer id="footer">
|
||||
|
||||
<?if (LANG_VERSION == 'ru'):?>
|
||||
|
||||
<div class="mobile-info">
|
||||
@@ -162,6 +159,7 @@
|
||||
<?php include get_template_directory().'/blocks/mobile-subscript.php';?>
|
||||
|
||||
|
||||
<footer id="footer">
|
||||
|
||||
<div id="footer_menu">
|
||||
<?php wp_footer(); ?>
|
||||
|
||||
Reference in New Issue
Block a user