<?php
/*
 * style one template
*/
?>

<div class="eblog-row ajaxpush">
<?php 



if ( $posts_query->have_posts() ):
    while ( $posts_query->have_posts() ): $posts_query->the_post();
?>
    <div class="eblog-col-lg-<?php echo esc_attr( $settings[ 'layout' ] ); ?> eblog-col-sm-6">
            <div class="eblog-single-inner <?php echo esc_attr(  $settings[ 'style' ] ); ?>">

            <div class="icon-img">
               <?php the_post_thumbnail(); ?>
            </div> 
            <div class="content-box">

            <?php 
            //enable meta
             if( 'yes' == $settings[ 'enable_meta' ] && 'before' == $settings[ 'metaposition' ] ):
            ?>
                <ul class="eblog-meta-inner">
                    <?php if( 'yes' == $settings[ 'enable_author' ] ) : ?>
                        <li><i class="fa fa-user"></i>
                            <?php the_author(); ?>
                        </li>
                    <?php endif; ?>
                    <?php if( 'yes' == $settings[ 'enable_comment' ]  ) : ?>
                        <li><i class="fa fa-comment-alt"></i>
                            <?php comments_popup_link(); ?>
                        </li>
                    <?php endif; ?>
                    <?php if( 'yes' == $settings[ 'enable_category' ] ) : ?>
                        <li><i class="fa fa-tag"></i><?php the_category(', '); ?></li>
                    <?php endif; ?>
                </ul>
            <?php endif; ?>

            <?php 

                //check if not hide title
                if( 'hide' != $settings[ 'dtitle' ] ) :

                ?>
                <<?php echo esc_attr( $settings[ 'titltag' ] ); ?> class="inner-title">

                <a href="<?php the_permalink(); ?>">

                    <?php
                     if( 'full' == $settings[ 'dtitle' ] ) :

                      the_title();

                      else :
                        echo wp_trim_words( get_the_title(), $settings[ 'title_excerpt_length' ], '' );
                     endif;
                     ?>
                        
                </a>

                </<?php echo esc_attr( $settings[ 'titltag' ] ); ?>>

                <?php endif; // end title ?>

            <?php 
            
            //enable meta
             if( 'yes' == $settings[ 'enable_meta' ] && 'after' == $settings[ 'metaposition' ] ):
            ?>
                <ul class="eblog-meta-inner">
                    <?php if( 'yes' == $settings[ 'enable_author' ] ) : ?>
                        <li><i class="fa fa-user"></i>
                            <?php the_author(); ?>
                        </li>
                    <?php endif; ?>
                    <?php if( 'yes' == $settings[ 'enable_comment' ]  ) : ?>
                        <li><i class="fa fa-comment-alt"></i>
                            <?php comments_popup_link(); ?>
                        </li>
                    <?php endif; ?>
                    <?php if( 'yes' == $settings[ 'enable_category' ] ) : ?>
                        <li><i class="fa fa-tag"></i><?php the_category(', '); ?></li>
                    <?php endif; ?>
                </ul>
              <?php endif; 

                // check if not hide content
                if( 'hide' != $settings[ 'dcontent' ] ) :

                  //check if excerpt enable
                  if( 'excerpt' == $settings[ 'dcontent' ] ) : ?>
                    <p><?php echo wp_trim_words( get_the_content(), $settings[ 'excerpt_length'] , '' ); ?></p>
                  <?php else : 
                    the_content();
                   endif;
                 endif;

                //check if read more enable
                if( 'yes' == $settings[ 'enable_readmore' ] ) :
                ?>

                <a class="<?php echo esc_attr( $settings[ 'readmorestyle' ] ); ?>" href="<?php the_permalink( ); ?>">

                        <?php echo esc_html( $settings[ 'btntext' ] ); ?>
                        <?php if( 'yes' == $settings[ 'enable_btn_icon' ] ) : ?>
                            <i class="<?php echo esc_attr( $settings[ 'icon' ] ); ?>"></i>
                        <?php endif; ?>
                    </a>
                <?php endif; ?>
                </div>
            </div>
    </div>
    <?php endwhile; endif; ?>
</div>
