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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -