Support

Account

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 NUMERIC or 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 meta_key argument.

    Second problem, this if block is not properly formatted
    if ($next_event_query->have_posts())
    there’s no colon and no endif statement

    The next problem I see is here

    
    $tradeshowslocation = get_sub_field('event_location', 40);
    

    and here

    
    <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.