So I’m using ACF to display some posts based on field.
I’m also using the standard WordPress loop to display some content. They both work fine, but when I try and place the ACF loop before the standard loop the_content won’t display.
I tired resetting the query, but that doesn’t seem to help. Any suggestions?
<pre>
<?php
$posts = get_posts(array(
'posts_per_page' => 50,
'post_type' => 'page',
'meta_key' => 'house_plan_available',
'meta_value' => 'ShowHousePlan'
));
if( $posts ): ?>
<ul id="HomePlansListUl" class="col-xs-12">
<?php foreach( $posts as $post ):
setup_postdata( $post )
?>
<li class="col-lg-3 col-md-4 col-sm-6 col-xs-12 list-unstyled">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
<img class="" src="<?php the_field('home_image'); ?>" alt="" />
</a>
</li>
<?php endforeach; ?>
</ul>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
<?php
if (have_posts()) :
while (have_posts()) :
the_post();
the_content();
endwhile;
endif;
?>
</pre>