Home › Forums › ACF PRO › Get Next Post › Reply To: Get Next Post
Now that I’m looking at all the code I can tell more.
Fist problem, do not set the meta type to
DATE. ACF does not store date fields as a proper MySQL date value. This should either be
CHAR, CHAR it the default so you can remove it or set it to NUMERIC
You need to set
meta_key argument in your query if you’re going to use
'orderby' => 'meta_value', setting a meta_query value is not the same as the
Second problem, this if block is not properly formatted
there’s no colon and no endif statement
The next problem I see is here
$tradeshowslocation = get_sub_field('event_location', 40);
<p class="eventdate"><?php the_sub_field('event_date'); ?><br /> <span class="locplace"><?php the_sub_field('event_location'); ?></span></p>
Inside the loop for your custom query ACF will be looking to get values from the post in the current loop and not the original post. The have_rows() loop in your code is looking at the original post and there is not have_rows() loop for these sub fields, so I’m still not sure where you’re trying to get field values from in your custom query loop.
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!
We’re hard at work on ACF 6.1, and Beta 1 is now available 🚀— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Let’s take a look 🧵https://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.