我在一个客户网站上工作,在WordPress更新到3.8版本后,我6个月前写的声明似乎停止了工作,我看不到也不知道为什么。
没有出现错误,它只是在类字段中返回带有post Id的空div。如果If语句为false,则需要回显不同的数据。但遗憾的是,它还没有吐出第一个H3标签。
<div class="span4">
<?php // Blog post query
$today = date(\'Y-m-d\');
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$currentID = get_the_ID();
query_posts(array(
\'post\' => \'ID\',
\'post_type\' => \'foodswaps\',
\'posts_per_page\' => 3,
\'meta_key\' => \'00.event-date\',
\'meta_value\' => $today,
\'meta_compare\' => \'>=\',
\'orderby\' => \'meta_value\',
\'order\' => \'ASC\'
));
if (have_posts()) : ?>
<h3 class="calendar">Upcoming Swaps</h3>
<?php while (have_posts()) : the_post(); ?>
<div <?php post_class(\'clear-spacer no-margin\'); ?>>
<?php
$field_name = "00.event-date";
$listEventDate = get_post_meta($post->ID, $field_name, true);
if (($listEventDate == \'E.g. yyyy-mm-dd\') && ($listEventDate == \'\')) { ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute( \'echo=0\' ); ?>">
<h4><?php the_title();?></h4>
<?php
$converted = date(\'Y-m-d\', strtotime($listEventDate));
$reversedDate = date(\'jS F Y\', strtotime($converted));
echo $reversedDate;?>
</a>
<?php } ?>
</div><!-- /.post_class -->
<?php // end of blog post loop.
endwhile; wp_reset_query(); // end of the loop and reset the query.
else:
echo \'<h3 class="theblog">Our Social Networks</h3>\';
echo \'<p>Why not visit us on our social networks?</p>\';
endif;?>