<h3>Événements à venir</h3>
<?php
$cat_array = array();
$args=array(
'post_type' => 'tribe_events',
'post_status' => 'publish',
'posts_per_page' => 10,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post();
$cat_args=array('orderby' => 'none');
$cats = wp_get_post_terms( $post->ID , 'tribe_events_cat', $cat_args);
foreach($cats as $cat) {
$cat_array[$cat->term_id] = $cat->term_id;
}
endwhile;
}
if ($cat_array) {
foreach($cat_array as $cat) {
$category = get_term_by('ID',$cat, 'tribe_events_cat');
echo "<div class='tribe-mini-calendar-list-wrapper'>";
echo '<div class="upcoming-cat tribe-events-category-'.$category->slug.'">';
echo "<h3 class='cat-title'>".$category->name."</h3>";
$eventpost = new WP_Query(array('post_type' => 'tribe_events', 'taxonomy' => 'tribe_events_cat', 'posts_per_page' => 5, 'term' => $category->slug));
while ($eventpost->have_posts()): $eventpost->the_post(); ?>
<!-- ><h2 class="entry-title summary new-title"><a href="<?php the_permalink();?>"><?php the_title(); ?></a></h2> -->
<div class="duration dates1">
<a href="<?php the_permalink();?>"><span class="date-start dtstart new-date"><?php the_field('date_personnalise');?></span></a></div>
<?php endwhile;
echo "</div></div>";
//echo '<a href="' . esc_attr(get_term_link($category, 'tribe_events_cat')) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a>'.'<br />';
}
}
else{
echo "No More Upcoming Events";
}
wp_reset_query();
?>