Files
vij/blocks/events.php

38 lines
838 B
PHP
Raw Normal View History

2021-09-18 01:30:09 +03:00
<?php
# три последних эвента
$posts = get_posts( array(
'numberposts' => 3,
2021-10-09 13:05:18 +03:00
'category' => 61, // 61 - мероприятия
2021-09-18 01:30:09 +03:00
'orderby' => 'date',
'order' => 'DESC',
'include' => array(),
'exclude' => array(),
'meta_key' => '',
'meta_value' =>'',
'post_type' => 'post',
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
) );
# вывод поста
2021-09-20 01:07:53 +03:00
if( $posts ):?>
2021-09-18 01:30:09 +03:00
2021-09-20 01:07:53 +03:00
<div id="events_left">
<?foreach($posts as $post):
setup_postdata( $post );
?>
2021-09-18 01:30:09 +03:00
2021-09-20 01:07:53 +03:00
<div class="event">
<div class="news_date"><?the_time('j F Y');?></div>
<a href="<?php the_permalink(); ?>"><?php the_title();?></a>
</div>
<?php endforeach;?>
2021-09-18 01:30:09 +03:00
2021-09-20 01:07:53 +03:00
</div>
2021-09-18 01:30:09 +03:00
2021-09-20 01:07:53 +03:00
<?wp_reset_postdata();
2021-09-18 01:30:09 +03:00
endif;