Shortcode with tesimonial id need query reset
-
I am using shortcode with single testimonial ID. After that I have a code another custom query. But, shortcode query cause issue to another next as there is no reset code added after calling single post query after line#461 in tb-testimonials.php.
else # single testimonial { if( ! is_numeric( $id ) ) return; $q = new WP_Query( array( 'p' => $id, 'post_type' => $this->post_type, 'post_status' => 'publish' ) ); if( $q->have_posts() ) { $return = ''; while( $q->have_posts() ) { $q->the_post(); $return .= $this->prepare_testimonial( is_null( $template ) ? 'shortcode' : $template ); } wp_reset_query(); // This reset is required. return $return; } else return; }
- The topic ‘Shortcode with tesimonial id need query reset’ is closed to new replies.