Hi,
I currently have a list of events on my website. Each of the events has a date (AFC Date Picker which is the_field(‘concert-datum’)).
I was wondering if it is possible to loop through all events, but have them divided by month. (Each month has a new <h2>Name of the month</h2> before the list of the next events starts)?
I currently have this query, that displays all events, ordered by their expiration date (which is the same as the ACF Date Picker Field):
<div id="concert-list" class="container">
<?php
$args = array( 'numberposts' => -1,
'cat' => '-1',
'order' => 'ASC',
'orderby' => 'meta_value',
'meta_key' => '_expiration-date',
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
get_template_part( 'concert-single' );
}
}
wp_reset_postdata();
?>
</div>
Did you get anywhere with this?