Shortcode in posts called by ajax is not working

I am using ajax to load content of post. Functions like the_title() works fine, but unfortunately the_content() doesn’t returns any shordcodes( gallery nor tablepress ) data.

here is my code:

Read More

functions.php

function showProd(){
   $id_prod = $_POST['id_prod'];
   $spec_post = posts_by_tax($id_prod, 'specification', 'products_category', '0', '1', '999');
   if($spec_post->have_posts()){
       while($spec_post->have_posts()){ $spec_post->the_post();
          get_template_part('single', 'specification');
       }
   }
   die();
}
add_action( 'wp_ajax_nopriv_showProd', 'showProd' );
add_action( 'wp_ajax_showProd', 'showProd' );

single-specification.php

<?php
$imgs_arr = theme_imgs();
?>
<h1><?php the_title(); ?></h1>
<img class="prod_under_top" src="<?php echo $imgs_arr['prod_main_under']; ?>" />
<?php if(has_post_thumbnail()){ ?>
<div class="spec_img"><?php the_post_thumbnail('full'); ?></div>
<?php } ?>
<div class="content-area">
<?php the_content(); ?>
    <div class="info_window">
        <div class="box">
            <?php 
                $posts = new WP_Query(array('post_type' => 'page', 'page_id' => 276));
                while($posts->have_posts()){$posts->the_post();
                    the_content();
                } 
            ?>
        </div>
    </div>
</div>
<div class="clearfix"></div>

javascript:

    jQuery.ajax({
        type: 'POST',
        url: pathname,
        data: { action: 'showProd', id_prod: id_prod },
        success: function(data, textStatus, XMLHttpRequest){
            jQuery('.pcd_wrapp').empty();
            jQuery('.pcd_wrapp').append(data);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown){
            alert(errorThrown);
        }            
    });

I was trying to var_dump($post->post_content), but it shows only null. Is it possible, that some core function blocking access or something?
Thank you in advance for help

EDIT

posts_by_tax() is function returns wp_query object,
pathname – path to admin-ajax.php

Related posts