add eng blocks
This commit is contained in:
45
blocks/enmoread.php
Normal file
45
blocks/enmoread.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
$posts = get_posts( array(
|
||||
'numberposts' => 4,
|
||||
'category' => 4782, // англ статьи
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC',
|
||||
'include' => array(),
|
||||
'exclude' => array(),
|
||||
'meta_key' => '',
|
||||
'meta_value' =>'',
|
||||
'post_type' => 'post',
|
||||
'post__not_in' => array($post_id),
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => '_thumbnail_id',
|
||||
//'compare' => 'EXISTS'
|
||||
)
|
||||
),
|
||||
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
|
||||
) );
|
||||
|
||||
# вывод поста
|
||||
if( $posts ):?>
|
||||
|
||||
<div class="moread_rubric">Read also:</div>
|
||||
|
||||
<div class="moread">
|
||||
|
||||
<?php foreach($posts as $post):
|
||||
setup_postdata( $post );?>
|
||||
|
||||
<div class="moread_card">
|
||||
<img src="<?php echo get_the_post_thumbnail_url($post);?>" alt="<?the_title();?>">
|
||||
<div class="moread_title"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></div>
|
||||
<div class="moread_date"><?echo mysql2date( 'j M Y H:i', $post->post_date, false );?></div>
|
||||
</div>
|
||||
|
||||
<?php endforeach;?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php wp_reset_postdata();
|
||||
|
||||
endif?>
|
||||
Reference in New Issue
Block a user