38 lines
983 B
PHP
38 lines
983 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
$posts = get_posts( array(
|
||
|
|
'numberposts' => 4,
|
||
|
|
'category' => 0, // пока без категории
|
||
|
|
'orderby' => 'date',
|
||
|
|
'order' => 'DESC',
|
||
|
|
'include' => array(),
|
||
|
|
'exclude' => array(),
|
||
|
|
'meta_key' => '',
|
||
|
|
'meta_value' =>'',
|
||
|
|
'post_type' => 'post',
|
||
|
|
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
|
||
|
|
) );
|
||
|
|
|
||
|
|
# вывод поста
|
||
|
|
if( $posts ):?>
|
||
|
|
|
||
|
|
<div class="moread">
|
||
|
|
<h4>Самое читаемое:</h3>
|
||
|
|
<?php foreach($posts as $post):
|
||
|
|
setup_postdata( $post );
|
||
|
|
?>
|
||
|
|
|
||
|
|
<div class="moread_card">
|
||
|
|
<img src="<?php echo get_the_post_thumbnail_url($post, 'moread');?>" alt="<?the_title();?>">
|
||
|
|
<a href="<?php the_permalink(); ?>"><?php the_title();?></a>
|
||
|
|
<div><?the_time('j F Y, G:i');?></div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<?php endforeach;?>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<?php wp_reset_postdata();
|
||
|
|
|
||
|
|
endif?>
|