WordPress.org

Ready to get started?Download WordPress

Forums

TBTestimonials
Shortcode with tesimonial id need query reset (1 post)

  1. Dinesh Kesarwani
    Member
    Posted 2 months ago #

    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;
    }

    https://wordpress.org/plugins/tb-testimonials/

Reply

You must log in to post.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 2 months ago by Dinesh Kesarwani
  • This topic is not resolved
  • WordPress version: 3.9.1

Tags

No tags yet.