add adaptive functions
This commit is contained in:
@@ -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?>
|
||||
|
||||
Reference in New Issue
Block a user