Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theodorocaliari/a13b1b36a01a5e4d33f5 to your computer and use it in GitHub Desktop.
Save theodorocaliari/a13b1b36a01a5e4d33f5 to your computer and use it in GitHub Desktop.
<?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();?>
<?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, 'meta_query' => array( array( 'key' => 'data_evento', 'value' => date('Ymd'), 'compare' => '>')) ));
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