Home Forums Front-end Issues Querying with ACF relationship values Reply To: Querying with ACF relationship values

  • 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 -->
    // add and else after the closing div
    else: ?>
      // you might need to do a reset here
      // put code to display something else here