<?php 
$title_length = cs_get_option('title_length');
$post_author_show = cs_get_option('post_author_show');
$post_date_show = cs_get_option('post_date_show');
$post_comment_show = cs_get_option('post_comment_show');

$post_author_show = is_null($post_author_show) ? true : $post_author_show;
$post_date_show = is_null($post_date_show) ? true : $post_date_show;
$post_comment_show = is_null($post_comment_show) ? true : $post_comment_show;
?>
<div class="pfy-post-grid-wrap pfy-overlay-style-2 style-4 post-spcat">
    <div class="row">
        <?php while ( have_posts() ) : the_post(); ?>
            <article id="post-<?php the_ID(); ?>" <?php post_class('col-lg-6 col-md-6 col-xl-6'); ?>>
                <div class="pfy-post-item d-flex align-items-center pfy-scale">
                    <?php if(has_post_thumbnail()):?>
											<div class="pfy-post-thumb pfy-img-commn-style">
													<a href="<?php the_permalink();?>"><?php the_post_thumbnail( 'full' );?></a>
											</div>
                    <?php endif;?>

                    <div class="pfy-post-content">
                        <?php benqu_category_badge();?>

                        <h3 title="<?php the_title();?>" class="pfy-post-title"><a href="<?php the_permalink();?>"><?php echo esc_html( wp_trim_words(get_the_title(), $title_length, '...') );?></a></h3>

												<?php if($post_author_show == true || $post_date_show == true || $post_comment_show == true): ?>
														<ul class="pfy-post-gd-meta">
																<?php if($post_author_show == true){ ?> <li><?php esc_html_e( 'BY', 'benqu' );?> <?php the_author_posts_link(); ?></li> <?php } ?>
																<?php if($post_date_show == true){ ?> <li><i class="fal fa-calendar-alt"></i> <?php echo get_the_date();?></li> <?php } ?>
																<?php if($post_comment_show == true){ ?>
																	<li>
																			<i class="far fa-comments"></i> 
																			<?php echo esc_attr(get_comments_number());?> <?php
																					if(get_comments_number() == 1 ) {
																							esc_html_e( 'Comment', 'benqu' );
																					} else{
																							esc_html_e( 'Comments', 'benqu' );
																					}                                
																			?>
																	</li>
																<?php } ?>
														</ul>
												<?php endif; ?>
                    </div>
                </div>
            </article>
            <?php endwhile; ?>
    </div>    
</div>