Support

Account

Home Forums Front-end Issues ACF Content not showing with multiple query_post Reply To: ACF Content not showing with multiple query_post

  • SOLUTION FOUND!

    I used this after each while:

    <?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>

    So the end product looks like this:

    // Display ACF content for category a
    <?php the_field('category_title_a'); ?
    <?php the_field('category_content_a'); ?>
    
    // Display posts from category a
    <?php $my_query = new WP_Query( 'category_name=cat-name' );
    while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
    //extra stuff here
    <?php endwhile; ?>
    
    <?php wp_reset_query();  // Restore global post data stomped by the_post(). ?>