function posts_ajax_func()
{
    $nopost = 4;
    //no of posts
    $post_type = $_POST['post_type'];
    //post type
    $category = intval($_POST['category']);
    //post category id
    $start_value = $_POST['start_val'];
    //start value
    if ($category != '') {
        $arg = array('post_type' => $post_type, 'numberposts' => -1, 'category' => $category, 'post_status' => 'publish');
    } else {
        $arg = array('post_type' => $post_type, 'numberposts' => -1, 'post_status' => 'publish');
    }
    $myposts = get_posts($arg);
    //get all posts from the post type
    $start_index = $start_value;
    //start index of testimonial array
    $end_index = $start_index + $nopost - 1;
    //end index of testimonial array
    ?>
		

	<?php 
    for ($i = 0; $i < $nopost; $i++, $start_index++) {
        if (!empty($myposts[$start_index]->ID)) {
            ?>
			
	<!--========================= Single post start ======================== -->
	        		<div class="blog_box">

	        			<div class="w-col w-col-3 w-col-stack col _0-5-0-5">
					          <a class="w-inline-block post-div-link-block" href="<?php 
            echo get_permalink($myposts[$start_index]->ID);
            ?>
">
					            <div class="post-div">
					              <div class="w-clearfix post-details-div">
					                <div class="post-details category">
					                		<?php 
            if ($category != '') {
                echo get_cat_name($category);
            } else {
                $post_categories = get_the_category($myposts[$start_index]->ID);
                $output_cat = '';
                if ($post_categories) {
                    foreach ($post_categories as $post_categories_single) {
                        $output_cat = $post_categories_single->name;
                        break;
                    }
                }
                echo $output_cat;
            }
            ?>
					                </div>
					                <div class="post-details date"><?php 
            echo get_the_time('m/d/Y', $myposts[$start_index]->ID);
            ?>
</div>
					              </div>					             

					              <?php 
            $post_thumbnail_url = wp_get_attachment_url(get_post_thumbnail_id($myposts[$start_index]->ID));
            if (get_the_post_thumbnail($myposts[$start_index]->ID)) {
                ?>
		                            		<img class="featured-image-thumb" src="<?php 
                echo $post_thumbnail_url;
                ?>
" alt="<?php 
                echo get_the_title($myposts[$start_index]->ID);
                ?>
">
		                            	<?php 
            } else {
                ?>

		              						<img class="featured-image-thumb" src="<?php 
                echo get_template_directory_uri();
                ?>
/images/no_product_img.jpg" alt="<?php 
                echo get_the_title($myposts[$start_index]->ID);
                ?>
">
		              					<?php 
            }
            ?>
 

					              <p class="post-blurb"> 
					              			<span class="post_listing_title"><?php 
            echo $myposts[$start_index]->post_title;
            ?>
</span>
					              <?php 
            echo get_the_popular_excerpt($myposts[$start_index]->post_content, 100);
            ?>
</p><a class="button read-more" href="<?php 
            echo get_permalink($myposts[$start_index]->ID);
            ?>
">read more</a>
					            </div>
					          </a>
        				</div>			
					</div>
			<!--========================= Single post end ======================== -->	
<?php 
        }
    }
    ?>

<?php 
    die;
}
		 <?php 
if ($left_second->have_posts()) {
    while ($left_second->have_posts()) {
        $left_second->the_post();
        ?>
			<a href="<?php 
        echo esc_url(get_permalink());
        ?>
">
			<article class="bottom">
				<h1><?php 
        the_title();
        ?>
</h1>
				<?php 
        echo get_the_popular_excerpt();
        ?>
				<p>
					<span class="italics">by</span> <?php 
        the_author();
        ?>
				</p>
				<?php 
        the_category();
        ?>
			</article>
			<a href="<?php 
        echo esc_url(get_permalink());
        ?>
">
		<?php