Home › Forums › ACF PRO › Get Next Post › Reply To: Get Next Post
Here is the code in the entirety. The content on the right posts, but I’m still not getting the next post for the left column:
<?php if( have_rows('tradeshows', 40) ): ?>
<?php
$current_event_date = get_sub_field('event_date');
$next_event_query = new WP_Query(array(
'post_type' => 'event',
'post_status' => 'publish',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'event_date',
'compare' => '>',
'value' => $current_event_date,
)
),
'meta_key' => 'event_date',
'orderby' => 'meta_value',
'order' => 'ASC'
));
$rows = get_field('tradeshows', 40);
?>
<div class="trades">
<?php if ($next_event_query->have_posts()) : while ($next_event_query->have_posts()): $next_event_query->the_post(); ?>
<div class="col-sm-3">
<h3>NEXT TRADESHOW</h3>
<p><?php echo $current_event_date; ?></p>
</div>
<?php wp_reset_postdata(); ?>
<?php endwhile; ?>
<?php endif; ?>
<div class="col-sm-6 col-sm-offset-3">
<h3>UPCOMING TRADESHOWS</h3>
<?php while( have_rows('tradeshows', 40) ): the_row(); ?>
<div class="col-sm-4">
<p class="eventdate"><?php the_sub_field('event_date'); ?><br />
<span class="locplace"><?php the_sub_field('event_location'); ?></span></p>
</div>
<?php endwhile; ?>
</div>
</div>
<?php endif; ?>
</div>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
2022 was a big year for Advanced Custom Fields, with more capabilities, a new generation of ACF Blocks, a refreshed UI, and a new home. Our year in review post looks at advancements we’ve made and offers a glimpse of the future.
— Advanced Custom Fields (@wp_acf) January 6, 2023
https://t.co/HahJUCcyH4
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.