I’m going to pare down your code just a bit. If I understand you want to show the tout-more-specialists div, including everything in it, only if there are posts returned here
$posts = get_field('doctor_specialties'); and show something else if not.
// move check for posts before opening div tag $this_post = $post->ID; $posts = get_field('doctor_specialties'); if( $posts ): ?> <div class="large-4 medium-4 small-12 columns tout-more-specialists" data-equalizer-watch="bridge"> <div class="single-specialty-container"> <!-- rest of div content here --> </div> </div> <?php // add and else after the closing div else: ?> // you might need to do a reset here wp_reset_postdata(); // put code to display something else here endif;
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!
ACF PRO’s Flexible Content field allows you to create smaller pieces of UI and compose them into whole flexible patterns. In our latest article, we show how to use it to create swappable site sections and integrate it all in a theme.https://t.co/ZRocH8oJSp— Advanced Custom Fields (@wp_acf) January 24, 2023
© 2023 Advanced Custom Fields.