php - Outputting the posts in a template is preventing tags below it to echo -


<?php $wpb_all_query = new wp_query(      array('post_type'=>'post', 'post_status'=>'publish', 'posts_per_page'=>-1) );  if ( $wpb_all_query->have_posts() ) : ?>      <?php while ( $wpb_all_query->have_posts() ) : $wpb_all_query->the_post();         $cats = get_the_category();         if ($cats[0]->cat_name === 'coaching') { ?>             <div class="callout horizontal">                  <?php the_post_thumbnail() ?>                  <div class="content">                     <h5><?php the_title(); ?></h5>                     <?php the_content(); ?>                 </div>              </div>         <?php } ?>     <?php endwhile; ?>  <?php endif; ?> 

the code above when removed allows <?php echo get_field('column_two'); ?> code run.

my question why code above blocking echoing of <?php echo get_field('column_two'); ?>

if trying get_field('column_two'); inside while loop, wordpress custom field column_two inside posts, seems present in page , not in post.

if trying access get_field('column_two'); after while loop, need reset post data, wp_reset_postdata(); see here: https://codex.wordpress.org/function_reference/wp_reset_postdata

hope helpful.


Comments

Post a Comment

Popular posts from this blog

filehandler - java open files not cleaned, even when the process is killed -

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -