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.
Thanks for give us valuable information
ReplyDeleteContact WordPress Support
WordPress Support Service
Very Helpful. Thanks for such Information
ReplyDelete24x7 WP Support
WP Technical Support