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,38 @@
<?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_opinions';
if (!$opinions = kuri_set($key)) {
$opinions = 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,$opinions);
}
# вывод поста
if( $posts ):
if($opinions ):
foreach($posts as $post):
setup_postdata( $post );
foreach($opinions as $post):
setup_postdata( $opinions );
?>
<div class="left_opinion">
<div class="left_opinion<?if (isset($subclass)) echo $subclass;?>">
<div class="left_opinion_title">мнение</div>
<img class="left_preview" src="<?php echo get_the_post_thumbnail_url($post, 'left-thumb');?>" alt="<?the_title();?>">
<div class="left_opinion_text"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></div>
<img class="left_preview" src="<?php echo get_the_post_thumbnail_url($post, 'left-thumb');?>" alt="<?=$post->post_title;?>">
<div class="left_opinion_text"><a href="<?=get_permalink($post);?>"><?=$post->post_title;?></a></div>
</div>
<?php endforeach;
wp_reset_postdata();
endif;