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;

View File

@@ -1,33 +1,35 @@
<?php
$posts = get_posts( array(
'numberposts' => 3,
'category' => 22, // пока без категории
'orderby' => 'date',
'order' => 'DESC',
'include' => array(),
'exclude' => array(),
'meta_key' => '',
'meta_value' =>'',
'post_type' => 'post',
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
) );
$key = 'vij_mosts';
if (!$mosts = kuri_set($key)) {
$mosts = get_posts( array(
'numberposts' => 3,
'category' => 22, // пока без категории
'orderby' => 'date',
'order' => 'DESC',
'include' => array(),
'exclude' => array(),
'meta_key' => '',
'meta_value' =>'',
'post_type' => 'post',
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
));
kuri_set($key, $mosts);
}
# вывод поста
if( $posts ):?>
if( $mosts ):?>
<div id="mosts">
<div class="mosts<?if (isset($subclass)) echo $subclass;?>">
<h3 class="most_title">Самое читаемое</h3>
<?php foreach($posts as $post):
setup_postdata( $post );
?>
<div class="most"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></div>
<?php endforeach;?>
<?php foreach($mosts as $most):?>
<div class="most"><a href="<?=get_permalink($most); ?>"><?=$most->post_title;?></a></div>
<?php endforeach;?>
</div>
<?php wp_reset_postdata();
endif?>
<?endif?>

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;