add adaptive functions

This commit is contained in:
2021-09-27 00:07:02 +03:00
parent b2e941fa06
commit 0e42ee8071
10 changed files with 288 additions and 91 deletions

View File

@@ -1,33 +1,37 @@
<?php
$posts = get_posts( array(
'numberposts' => 1,
'category' => 7, // 7 - мнения
'orderby' => 'date',
'order' => 'DESC',
'include' => array(),
'exclude' => array(),
'meta_key' => '',
'meta_value' =>'',
'post_type' => 'post',
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
) );
$key = 'vij_citata';
if (!$posts = kuri_set($key)) {
$posts = get_posts( array(
'numberposts' => 1,
'category' => 7, // 7 - мнения
'orderby' => 'date',
'order' => 'DESC',
'include' => array(),
'exclude' => array(),
'meta_key' => '',
'meta_value' =>'',
'post_type' => 'post',
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
));
kuri_set($key, $posts);
}
# вывод поста
if( $posts ):
foreach($posts as $post):
setup_postdata( $post );
?>
foreach($posts as $post):?>
<div class="left_citata">
<div class="left_citata<?if (isset($subclass)) echo $subclass;?>">
<div class="left_citata_title">цитата</div>
<img class="left_preview" src="<?php echo get_the_post_thumbnail_url($post, 'left-thumb');?>" alt="<?the_title();?>">
<div class="left_citata_text"><a href="<?php the_permalink(); ?>">«<?php the_title();?>»</a></div>
<div class="left_citata_text"><a href="<?=get_permalink($post);?>">«<?=$post->post_title;?>»</a></div>
</div>
<?php endforeach;
wp_reset_postdata();
endif;