Skip to content

Instantly share code, notes, and snippets.

@walterjaworski
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save walterjaworski/6e8312c6c35606cd286e to your computer and use it in GitHub Desktop.
Save walterjaworski/6e8312c6c35606cd286e to your computer and use it in GitHub Desktop.
Loop Eventos
<?php
global $wp_query;
$wp_query = new WP_Query(
array(
'post_type' => 'event',
'order' => 'ASC',
'orderby' => array( 'meta_value_num' => 'ASC', 'title' => 'ASC' ),
'meta_key' => 'data_evento',
'posts_per_page' => 6 ));
if($wp_query->have_posts()): ?>
<?php while ($wp_query->have_posts()): $wp_query->the_post(); ?>
<?php
$meta = get_field('data_evento');
$dia_semana = date_i18n('l', strtotime($meta));
$dia_mes = date_i18n('d', strtotime($meta));
$mes = date_i18n('M', strtotime($meta));
?>
<div class="box-evento-home col-md-2 col-xs-12">
<div class="calendar-small col-md-12">
<span class="s-month" style="text-transform:uppercase;"><?php echo $mes; ?></span>
<span class="s-date"><?php echo $dia_mes; ?></span>
</div>
<div class="event-small-details col-md-12">
<h5 class="event-small-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
<div class="event-small-meta small-text">
<p><a href="<?php the_permalink(); ?>"><?php //the_field('data_evento'); ?> + Leia mais</a></p>
</div>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_postdata();?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment