54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
get_header();
|
|
global $tp;
|
|
|
|
$term = get_queried_object();
|
|
$hero = get_field('hero', $term);
|
|
|
|
$posts = get_posts(array(
|
|
'category_name' => 'news',
|
|
'post_type' => 'post',
|
|
'post_status' => array('publish'),
|
|
'meta_query' => array(
|
|
'relation' => 'AND',
|
|
array(
|
|
'key' => 'date',
|
|
),
|
|
),
|
|
'meta_key' => 'date',
|
|
'orderby' => 'meta_value',
|
|
'order' => 'ASC',
|
|
'numberposts' => -1,
|
|
));
|
|
|
|
|
|
$posts_will = [];
|
|
|
|
foreach ($posts as $p) {
|
|
$post_time = get_field('date', $p->ID);
|
|
if (!empty($post_time)) {
|
|
if (strtotime(date('d/m/Y')) <= strtotime($post_time)) {
|
|
$posts_will[] = $p;
|
|
}
|
|
}
|
|
}
|
|
|
|
$posts_will = array_slice($posts_will, 0, 3);
|
|
|
|
?>
|
|
|
|
<?php if (!empty($posts_will)) : ?>
|
|
<div class="posts-list fw tagged-posts">
|
|
<div class="posts-list__wrapper">
|
|
<div class="list-items list-items_events">
|
|
<?php foreach ($posts_will as $post) : ?>
|
|
<?php
|
|
setup_postdata($post);
|
|
get_template_part('partials/list-item', 'event');
|
|
?>
|
|
<?php endforeach ?>
|
|
<?php wp_reset_postdata(); ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|