corect archiv

This commit is contained in:
arlemp@selectel.ru
2022-01-13 20:33:50 +03:00
parent f89bd9d939
commit e4ad3c6397
3 changed files with 67 additions and 47 deletions

View File

@@ -26,11 +26,15 @@ if( $posts ):
<?if (LANG_VERSION == 'ru'):?> <?if (LANG_VERSION == 'ru'):?>
<div class="right_archive_link"><a href="<?php the_permalink(); ?>"><?=the_title();?></a></div> <div class="right_archive_link"><a href="<?php the_permalink(); ?>"><?=the_title();?></a></div>
<?endif?> <?endif?>
<br>
<center class="left_center_block">
<a href="https://vetandlife.ru/category/arkhiv/" class="left_button" target="_blank">Архив номеров</a>
</center>
</div> </div>
<?php endforeach; <?php endforeach;
wp_reset_postdata(); wp_reset_postdata();?>
endif; <?php endif;

View File

@@ -33,6 +33,17 @@ get_header();?>
$page = get_query_var('paged'); $page = get_query_var('paged');
$curryear = date('Y'); $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) { if ($page == 0) {
$page = 1; $page = 1;
$numbers_year = $curryear; $numbers_year = $curryear;
@@ -42,15 +53,21 @@ else {
} }
$posts = get_posts( array( $curr_params = $year_params;
'posts_per_page' => -1 , $curr_params['year'] = $numbers_year;
'category' => 3, // 19 - архив газеты,
'year' => $numbers_year, $posts = get_posts($curr_params);
'orderby' => 'date',
'order' => 'DESC', if (count($posts) == 0){
'post_type' => 'post',
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса $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 --> </div> <!--//end minicard block -->
<?//get_template_part( '/blocks/paginator');?>
<?endif?>
<div class="pagination-wrapper"> <div class="pagination-wrapper">
<nav class="navigation pagination" role="navigation" aria-label="Записи"> <nav class="navigation pagination" role="navigation" aria-label="Записи">
<div class="nav-links"> <div class="nav-links">
@@ -103,17 +127,11 @@ $posts = get_posts( array(
<?endfor?> <?endfor?>
</div> </div>
</nav> </nav>
</div> </div>
<?//get_template_part( '/blocks/paginator');?>
<?endif?>
</div> </div>

View File

@@ -120,48 +120,46 @@
</div> </div>
</div><!-- end main --> </div><!-- end main -->
<?if (LANG_VERSION == 'ru'):?>
<footer id="footer"> <div class="mobile-info">
<a href="https://www.youtube.com/channel/UCOXOjXmMNl8eVO4ldrv5c5Q" target="_blank">
<?if (LANG_VERSION == 'ru'):?> <img src="https://vetandlife.ru/wp-content/uploads/2021/10/melano-live.png" width="240" height="200" />
</a>
<div class="mobile-info"> </div>
<a href="https://www.youtube.com/channel/UCOXOjXmMNl8eVO4ldrv5c5Q" target="_blank">
<img src="https://vetandlife.ru/wp-content/uploads/2021/10/melano-live.png" width="240" height="200" />
</a>
</div>
<?get_template_part( '/blocks/mosts', null, ['subclass' => 'mob-lite']);?> <?get_template_part( '/blocks/mosts', null, ['subclass' => 'mob-lite']);?>
<div class="mobile-info"> <div class="mobile-info">
<a href="https://vetandlife.ru/category/sdelano-chestno/?utm_medium=banner&utm_campaign=mobile&utm_source=site" target="_blank"> <a href="https://vetandlife.ru/category/sdelano-chestno/?utm_medium=banner&utm_campaign=mobile&utm_source=site" target="_blank">
<img src="https://vetandlife.ru/wp-content/uploads/2021/12/fair_240x200.jpg" width="240" height="200" /> <img src="https://vetandlife.ru/wp-content/uploads/2021/12/fair_240x200.jpg" width="240" height="200" />
</a> </a>
</div> </div>
<?endif?> <?endif?>
<?php include get_template_directory().'/blocks/mobile-gazeta.php';?> <?php include get_template_directory().'/blocks/mobile-gazeta.php';?>
<?if (LANG_VERSION == 'ru'):?> <?if (LANG_VERSION == 'ru'):?>
<div class="mobile-info"> <div class="mobile-info">
<a href="https://vetandlife.ru/parthers/fgbu-vgnki-provodit-mezhlaboratornye-slichitelnye-ispytaniya-msi-v-oblasti-pokazatelej-kachestva-i-bezopasnosti-pishhevyh-produktov-rastitelnogo-i-zhivotnogo-proishozhdeniya-kormov-i-kormovyh-sredstv/" target="_blank"> <a href="https://vetandlife.ru/parthers/fgbu-vgnki-provodit-mezhlaboratornye-slichitelnye-ispytaniya-msi-v-oblasti-pokazatelej-kachestva-i-bezopasnosti-pishhevyh-produktov-rastitelnogo-i-zhivotnogo-proishozhdeniya-kormov-i-kormovyh-sredstv/" target="_blank">
<img src="https://vetandlife.ru/wp-content/uploads/2022/01/vgnki_240x200_january.jpg" width="240" height="200" /> <img src="https://vetandlife.ru/wp-content/uploads/2022/01/vgnki_240x200_january.jpg" width="240" height="200" />
</a> </a>
</div> </div>
<div class="mobile-info"> <div class="mobile-info">
<a href="https://vetandlife.ru/без-рубрики/veterinariya-i-zhizn-obyavlyaet-o-novom-fotokonkurse-sovremennoe-zhivotnovodstvo-i-veterinariya/"> <a href="https://vetandlife.ru/без-рубрики/veterinariya-i-zhizn-obyavlyaet-o-novom-fotokonkurse-sovremennoe-zhivotnovodstvo-i-veterinariya/">
<img src="https://vetandlife.ru/wp-content/uploads/2022/01/new_comp_240x200.jpg" width="240" height="200" /> <img src="https://vetandlife.ru/wp-content/uploads/2022/01/new_comp_240x200.jpg" width="240" height="200" />
</a> </a>
</div> </div>
<?endif?> <?endif?>
<?php include get_template_directory().'/blocks/mobile-subscript.php';?> <?php include get_template_directory().'/blocks/mobile-subscript.php';?>
<footer id="footer">
<div id="footer_menu"> <div id="footer_menu">
<?php wp_footer(); ?> <?php wp_footer(); ?>