Files
vij/blocks/events.php
2022-04-06 00:10:37 +03:00

50 lines
1.2 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php echo calend_block(date('m'), date('Y'), true);
# три последних эвента
$posts = get_posts( array(
'numberposts' => 3,
'category' => 61, // 61 - мероприятия
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'startevent',
'value' => date("Y-m-dTH:i:s"),
'compare' => '>=',
'type' => 'DATE'
),
),
'post_type' => 'post',
'post_status' => 'publish',
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
) );
# вывод поста
if( $posts ):?>
<div id="events_left">
<?foreach($posts as $post):
setup_postdata( $post );
?>
<div class="event">
<?$eventdate = get_post_meta( $post->ID, 'startevent', true );?>
<div class="news_date"><?=eventdate_str($eventdate)?></div>
<a href="<?php the_permalink(); ?>"><?php the_title();?></a>
</div>
<?php endforeach;?>
</div>
<center class="left_center_block">
<a href="https://vetandlife.ru/category/vystavki-i-konferenitsii/" class="left_button" target="_blank">Все мероприятия</a>
</center>
<?wp_reset_postdata();
endif;