【发布时间】:2015-09-14 17:22:56
【问题描述】:
我正在使用高级自定义字段插件在自定义帖子中创建事件日期。我想在那个日期之前订购我的活动,但它不适合我:
<div class="column one">
<?php
$args = array(
'post_type' => 'formation',
'posts_per_page' => -1,
'post_status' => 'publish',
'meta_key' => 'date_formation',
'orderby' => 'meta_value_num',
'order' => 'DESC'
);
$posts_query = new WP_Query( $args );
while ($posts_query->have_posts()) : $posts_query->the_post();
$presentation = get_field('date_formation');
$date_formation = mysql2date( 'j F Y ', $presentation);
$lieu = get_field('adresse_formation');
?>
<div class="column one-third eventpost">
<div class="event-col">
<?php echo '<h4>'.$date_formation.''.$lieu.'</h4>'; ?>
<?php if( !is_single() ) {?><?php the_excerpt(); ?> <?php }else{ ?>
<?php the_content(); ?>
<?php } ?>
<p><a href="<?php the_permalink(); ?>" rel="bookmark" title="En savoir plus">En savoir plus<i class="icon-right-open"></i></a></p>
</div>
</div>
<?php endwhile; wp_reset_query(); ?>
</div>
【问题讨论】:
标签: wordpress date advanced-custom-fields