Can't show / hide a part in WordPress with the normal loop -


i tried following. when there content show, show + show h3 <h3>overview</h3>, if not show noting.

but not work me. code:

        <?php              $heroimage = get_field('hero_image' );              $alt = $image['title' ];         ?>         <?php if ($heroimage) : ?>              <div class="grid_12">                 <img src="<?php echo $heroimage; ?>" alt="<?php echo $alt; ?>"/>             </div><!-- end div.grid_12 -->          <?php endif; ?>          <?php if (have_posts()) : while (have_posts()) : the_post(); ?>              <article class="grid_8">                 <h3>overview</h3>                 <?php the_content(); ?>             </article><!-- end article.grid_8 -->          <?php endwhile; ?> 

the first part of hero image image plugin advanced custom fields. problem lies on if have_posts etc..

thanks advance!

regarding codex, should be

   <?php      if (have_posts()) :          while (have_posts()) : the_post(); ?>                 <article class="grid_8">                     <h3>overview</h3>                     <?php the_content(); ?>                 </article><!-- end article.grid_8 -->        <?php endwhile;     endif;     ?> 

you forgot close if statement.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -