Shortcode twice on the same page Wordpress
<p>I'm trying to add a shortcode twice on the same page, but the problem is that the second shortcode is not showing nothing. I think it can be some problem with the query, but I am not sure about this. Here is my shortcode:</p>

<pre class="lang-php prettyprint-override"><code>&lt;?php 

defined( 'ABSPATH' ) or die( 'No script kiddies please!' );

if ( ! is_admin() ) {
        require_once( ABSPATH . 'wp-admin/includes/post.php' );
}

function eleva_shortcode($atts = array()){

    $atts=shortcode_atts( array(

        'display' =&gt; '3', 
        'limit' =&gt; '5',
        'length' =&gt; '15',
        'title'  =&gt; "",
        'category' =&gt; ""
    ), $atts ) ;

    $display = $atts['display'] ;
    $pars = intval($display);
    $col = 0;

    if($pars==1 || $pars==2 || $pars==3 || $pars==4 || $pars==6){
        $col = 12 / $pars;
    }

    else{

        $pars =3;

        $col = 12 / $pars;

    } 

    $limit = $atts['limit'];

    $pars_limit = intval($limit);

    $length = $atts['length'];

    $pars_length = intval($length);

    $title = $atts['title'];

    $id = post_exists($title);

    $taxonomy = $atts['category'];


    ?&gt;

     &lt;script&gt;

            var tQ = jQuery.noConflict();

        tQ(document).ready(function(){

            if (tQ(window).width() &gt; 992) {

                var testimonialItem = tQ('#testimonials-slider-shortcode div[class*="col-md-"]');

                for(var i = 0; i &lt; testimonialItem.length; i+=&lt;?php echo $pars;?&gt;) {

                    testimonialItem.slice(i, i+&lt;?php echo $pars;?&gt;).wrapAll('&lt;div class="item"&gt;&lt;/div&gt;');

                }

            } else{

                var testimonialItem = tQ('#testimonials-slider-shortcode div[class*="col-md-"]');

                for(var i = 0; i &lt; testimonialItem.length; i+=1) {

                    testimonialItem.slice(i, i+1).wrapAll('&lt;div class="item"&gt;&lt;/div&gt;');

                }

            }

            var testimonialBoxShort = 0;

            tQ('#testimonials-slider-shortcode .item').each(function(){  

                if(tQ(this).height() &gt; testimonialBoxShort){  

                    testimonialBoxShort = tQ(this).height();  

                }

            });    

            tQ('#testimonials-slider-shortcode .item').height(testimonialBoxShort);

            tQ('#testimonials-slider-shortcode .item').first().addClass('active');

        }); 

    &lt;/script&gt;

    &lt;div id="testimonials-slider-shortcode" class="carousel slide" data-ride="carousel"&gt;

        &lt;ol class="carousel-indicators"&gt;&lt;/ol&gt;

        &lt;div class="carousel-inner" role="listbox"&gt;

        &lt;?php



        if($id == 0 &amp;&amp; empty($taxonomy) ){

            $queryT = new WP_Query( array( 'post_type' =&gt; 'testimonials') );

        }elseif ($id == 0 &amp;&amp; !empty($taxonomy)){

              $queryT = new WP_Query( array( 'post_type' =&gt; 'testimonials', 'tax_query' =&gt; array(
                          array(
                           'taxonomy' =&gt; 'categorytestimonials',
                           'field'    =&gt; 'slug',
                           'terms'    =&gt; $taxonomy,
                          )) )); //p is for the id;

        }elseif ($id != 0 &amp;&amp; empty($taxonomy)){

              $queryT = new WP_Query( array( 'post_type' =&gt; 'testimonials', 'p' =&gt; $id) ); //p is for the id;

        }else{

              $queryT = new WP_Query( array( 'post_type' =&gt; 'testimonials', 'p' =&gt; $id, 'tax_query' =&gt; array(
                          array(
                           'taxonomy' =&gt; 'categorytestimonials',
                           'field'    =&gt; 'slug',
                           'terms'    =&gt; $taxonomy,
                          )) )); //p is for the id;) ); //p is for the id;

        }     

        if ( $queryT-&gt;have_posts() ) : ?&gt;

            &lt;!-- the loop --&gt;

            &lt;?php $count = 0;

            while ( $queryT-&gt;have_posts()) : $queryT-&gt;the_post(); ?&gt;

            &lt;?php   //variables

                $author = get_post_meta( get_the_ID(), 'author', true ); 

                $link = get_permalink();

            ?&gt;

            &lt;?php if($count &lt; $pars_limit || $pars_limit==0): ?&gt;

            &lt;div class="col-md-&lt;?php echo $col;?&gt;"&gt;

                &lt;div class="img-wrap"&gt;

                    &lt;?php if ( has_post_thumbnail() ) : // check if the post has a Post Thumbnail assigned to it. ?&gt;

                        &lt;a href="&lt;?php echo $link;?&gt;"&gt;

                            &lt;?php the_post_thumbnail('full');?&gt;

                        &lt;/a&gt;

                    &lt;?php else : ?&gt;

                        &lt;a href="&lt;?php echo $link;?&gt;"&gt;

                            &lt;img alt="&lt;?php bloginfo('name'); ?&gt;" src="&lt;?php echo get_template_directory_uri(); ?&gt;/images/default.jpg"&gt;

                        &lt;/a&gt;

                    &lt;?php endif; ?&gt;

                &lt;/div&gt;

                &lt;div class="info-wrap"&gt;

                    &lt;p&gt;&lt;?php echo eleva_testimonials_excerpt($pars_length +1); ?&gt;&lt;/p&gt;

                    &lt;?php // Check if the custom field has a value.

                        if ( ! empty( $author ) ) {

                            echo '&lt;span&gt;&lt;a href="'. $link .'"&gt;'. $author . '&lt;/a&gt;&lt;/span&gt;';

                        }

                    ?&gt;  

                &lt;/div&gt;

            &lt;/div&gt;

            &lt;?php endif;

                  $count= $count +1;?&gt;

            &lt;?php endwhile; ?&gt;

            &lt;!-- end of the loop --&gt;

            &lt;?php wp_reset_postdata(); ?&gt;

        &lt;/div&gt;

        &lt;a class="left carousel-control" href="#testimonials-slider-shortcode" role="button" data-slide="prev"&gt;

            &lt;span class="glyphicon glyphicon-chevron-left fa fa-angle-left" aria-hidden="true"&gt;&lt;/span&gt;

            &lt;span class="sr-only"&gt;Previous&lt;/span&gt;

        &lt;/a&gt;

        &lt;a class="right carousel-control" href="#testimonials-slider-shortcode" role="button" data-slide="next"&gt;

            &lt;span class="glyphicon glyphicon-chevron-right fa fa-angle-right" aria-hidden="true"&gt;&lt;/span&gt;

            &lt;span class="sr-only"&gt;Next&lt;/span&gt;

        &lt;/a&gt;

        &lt;?php else : ?&gt;

            &lt;p&gt;&lt;?php _e( 'Sorry, no testimonials at this time' ); ?&gt;&lt;/p&gt;

        &lt;?php endif; ?&gt;

            &lt;/div&gt; 
       &lt;?php
}

add_shortcode('testimonials', 'eleva_shortcode');

 ?&gt;
</code></pre>