[Plugin: Multiple Content Blocks] Fields Not Showing After custom query loop
-
I’ve ran into some problems using this plugin. On the first sections of my page template, the content blocks are working, until I tried adding a new one after a section where I have a custom query loop.
Like this:
<section1> <?php the_block('front-s1-heading', array('label'=>'Section 1 - Big Red Text', 'type' => 'one-liner' )); // Working ?> </section1> <section2> <?php // Define custom query parameters $custom_query_args = array( 'posts_per_page' => '1', 'post_type' => 'testimonial', 'post_status' => 'publish', 'order' => 'ASC' ); // Get current page and append to custom query parameters array $custom_query_args['paged'] = get_query_var( 'page' ) ? get_query_var( 'page' ) : 1; // Instantiate custom query $custom_query = new WP_Query( $custom_query_args ); // Pagination fix $temp_query = $wp_query; $wp_query = NULL; $wp_query = $custom_query; if ($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <div id="testimonial-<?php the_ID(); ?>" class="testimonial-item center-block"> <hr> <div class="row"> <div class="testimonial-em col-md-6"> <h3 class="testimonial-title"><?php the_field('big_text'); ?></h3> </div> <div class="testimonial-rg col-md-6"> <?php the_content(); ?> <p>- <?php the_title(); ?></p> </div> </div> </div> <?php endwhile; ?> <?php //the_posts_navigation(); ?> <?php endif; wp_reset_postdata(); // Reset main query object $wp_query = NULL; $wp_query = $temp_query; ?> </section2> <section3> <?php the_block('front-s3-heading', array('label'=>'Section 3 - Big Red Text', 'type' => 'one-liner' )); // NOT Working ?> </section3>
I tried removing the section with the custom loop and the blocks are showing.
P.S. I’m using another plugin (Advanced Custom Fields), and tried removing this code
<?php the_field('big_text'); ?>
but it’s still not working.
- The topic ‘[Plugin: Multiple Content Blocks] Fields Not Showing After custom query loop’ is closed to new replies.