<?php 
    $related_title = cs_get_option('related_title');
    global $post;

    $relatedposts = get_posts( array( 
	
	'category__in' => wp_get_post_categories($post->ID), 
	'numberposts' => 2,
	'order'       => 'ASC',
	'post__not_in' => array($post->ID) ) 
	
	);
	
    if( $relatedposts ) : ?>

<div class="pfy-post-grid-wrap releted-post-wrap grid-style-6">
    <div class="row pfy-loadmore-info">
	<?php if(!empty($related_title)):?>
    <div class="col-lg-12">
        <h2 class="releted-title"><?php echo esc_html($related_title);?></h2>
    </div>
	<?php endif;?>
    <?php foreach( $relatedposts as $post ) {
		
    setup_postdata($post); ?>

    <div class="col-lg-6 pfy-grid-item">
        <div class="pfy-post-item item-act pfy-scale">
            <?php if(has_post_thumbnail()):?>
            <div class="pfy-post-thumb pfy-img-commn-style">
                <a class="post-thumb" href="<?php the_permalink();?>"><?php the_post_thumbnail( 'full' );?></a>
            </div>
            <?php endif;?>
            <div class="pfy-post-content">					
                <?php benqu_category_badge();?>
                <h4 class="pfy-post-title"><a href="<?php the_permalink();?>"><?php the_title();?></a></h4>
                <ul class="pfy-post-gd-meta">
                    <li><i class="far fa-user"></i> <?php the_author_posts_link(); ?></li>
                    <li><i class="fal fa-calendar-alt"></i> <?php echo get_the_date();?></li>
                </ul>
                <div class="pfy-post-excerpt">
                    <?php echo wp_trim_words(get_the_excerpt(), 20, '')  ;?>
                </div>
            </div>
        </div>
    </div>
    <?php } 
	
	wp_reset_postdata();?>

   </div>
   </div>

    <?php endif; ?>