title: Nested If else statements used in a WordPress template isn't working
body: <p>I'm not sure what is wrong with the nested conditions below. The else block never seems to get executed even when the image variable is not set(hero image being absent). Please help me find the problem with it.</p>
  <pre><code>&lt;?php
  if ( is_singular() || is_page() ):
  if( have_rows('hero') ): while( have_rows('hero') ): the_row();
  if( have_rows('hero_-_background_options') ): while( have_rows('hero_-_background_options') ): the_row();
  $image = get_sub_field('background_-_image');
  if($image):
  ?&gt;
  .default-hero .col .hero-bkg {
      display:none;
  }
  &lt;?php  endif; endwhile; endif; endwhile; else: ?&gt;
  .default-hero.relative.bg-grey-light {
    display: none;
  }
  &lt;?php endif; endif; ?&gt;
  </code></pre>