我不明白为什么这个自定义循环没有为我显示:。我尝试删除if语句和某些查询参数,但它就是不显示。如果我完全删除循环,页面就会显示布局,所以我知道这是循环本身,我就是找不到问题所在。
有人注意到我做错了什么吗?
<?php /* Start the Loop */ ?>
<?php
query_posts(array(
\'post_type\' => \'events\',
\'showposts\' => 10 ,
\'meta_key\' => \'event_datestart\',
\'orderby\' => \'meta_value\' ,
\'order\' => \'ASC\' ,
) );
?>
<?php while (have_posts()) : the_post(); ?>
<?php
$raweventstart = get_field(\'event_datestart\');
$raweventend = get_field(\'event_dateend\');
$eventstart = strtotime("$raweventstart");
$eventend = strtotime ("$raweventend");
$now = strtotime("now");
//Check if event is in the future or past.
if ($eventstart >= $now) {
?>
<div class="main-area-section-content">
<div class="event-wrapper">
<div class="event-header">
<div class="event-date">
<?php echo $raweventstart; ?>
</div>
<div class="venue-name">
<?php if (get_field (\'venue_name\') ) { the_field(\'venue_name\'); } ?>
</div>
</div>
<div class="event-content">
<div class="event-address">
<?php if (get_field (\'venue_address\') ) { the_field(\'venue_address\'); } ?>
</div>
<div class="venue-phone">
<?php if (get_field (\'venue_phone\') ) { the_field(\'venue_phone\'); } ?>
</div>
<div class="venue-website">
<?php if (get_field (\'venue_website\') ) { ?><a href="<?php echo get_field(\'venue_website\'); } ?>">Venue Website</a>
</div>
<div class="event-description">
<?php if (get_field (\'event_description\') ) { the_field(\'event_description\'); } ?>
</div>
</div>
</div>
</div>
<?php } //end check to see if event is in the past?>
<?php endwhile;?>
<?php wp_reset_query(); ?>