Na tabela wp_posts
, os dados estão assim :
e quando insiro algum evento, alem dessa tabela acima, vai dados para wp_postmeta
, e ficam assim:
no arquivo que exibe os eventos fica assim:
<div class="latest-events">
<?php query_posts('post_type=event&posts_per_page=3'); if (have_posts()) : while (have_posts()) : the_post(); ?>
<article class="latest-event cf">
<?php if(ale_get_meta('event_date')) { ?>
<time datetime="2014-08-09" class="date">
<?php $date_event = ale_get_meta('event_date');
$date_event_one = explode('/',$date_event); ?>
<span class="date__day"><?php echo date("d", mktime(0, 0, 0, $date_event_one[0], $date_event_one[1], $date_event_one[2])); ?></span>
<?php echo date("M", mktime(0, 0, 0, $date_event_one[0], $date_event_one[1], $date_event_one[2])); ?>
<span class="date__year"><?php echo date("Y", mktime(0, 0, 0, $date_event_one[0], $date_event_one[1], $date_event_one[2])); ?></span>
</time>
<!-- End date -->
<?php } else { ?>
<time datetime="2014-08-09" class="date">
<span class="date__day"><?php echo get_the_date('d'); ?></span>
<?php echo get_the_date('M'); ?>
<span class="date__year"><?php echo get_the_date('Y'); ?></span>
</time>
<!-- End date -->
<?php } ?>
<div class="latest-event__wrap">
<header class="latest-event__header">
<h1 class="latest-event__title">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h1>
<?php $cur_terms = get_the_terms( $post->ID, 'event-category' );
if($cur_terms != '') { ?>
<p class="latest-event__category">
<?php
foreach($cur_terms as $cur_term){
echo ' '. $cur_term->name.' ';
}
?>
</p>
<?php } ?>
</header>
<!-- End event post header -->
<p><?php trim_content_chars(120,'...') ?></p>
</div>
<!-- End event post wrap -->
<a href="<?php the_permalink(); ?>" class="btn-more">+</a>
</article>
<!-- End event post-->
<?php endwhile; else: ?>
<?php ale_part('notfound')?>
<?php endif; wp_reset_query(); ?>
</div>
<!-- End Events posts -->
Como exibir os eventos por ordem decrescente, sendo que a data do evento vai para a tabela wp_postmeta
, no campo meta_value
?