我在一个网站上工作,并创建了一个"事件"帖子类型,这是拉事件,并显示他们是否大于今天的日期:
<section class="row home-news bg-pale-blue" id="events__section">
<div class="inner">
<div class="block">
<div class="columns listing-title wide-gutter">
<div class="col1-2 title">
<h3>Upcoming Events</h3>
</div>
</div>
<div class="columns article-listing news-listing wide-gutter">
<?php
$today = date('Ymd');
$homepageEvents = new WP_Query(array(
'posts_per_page' => 3,
'post_type' => 'event',
'meta_key' => 'event_date',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'event_date',
'compare' => '>=',
'value' => $today,
'type' => 'numeric'
)
)
));
while($homepageEvents->have_posts()){
$homepageEvents->the_post(); ?>
<div class="col1-3 item">
<a class="blog-line" href="<?php the_permalink(); ?>">
<span class="date"><?php the_field('event_date',$post->ID); ?></span>
<h2><?php the_title(); ?></h2>
<p><?php echo wp_trim_words(get_field('summary_text',$post->ID), 25); ?></p>
<span class="more-link"><i class="fa fa-chevron-circle-right"></i> Read more</span>
</a>
</div>
<?php } ?>
</div>
</div>
</div>
</section>
我想要做的是隐藏整个部分,如果没有即将到来的活动,怎么做呢?
基于此,我只需要隐藏该部分,如果所有当前事件都是:‘Value’<;$Today,
非常感谢