<?php
/*
 * style four template
*/
?>
<div class="eblog-row">
<?php 

    if ( $posts_query->have_posts() ):
    while ( $posts_query->have_posts() ): $posts_query->the_post();

    $img_id    = get_post_thumbnail_id( get_the_ID() );
    $image_alt = get_post_meta( $img_id, '_wp_attachment_image_alt', true );
    $src       = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full', false, '' );

?>
<div class="eblog-col-lg-4 eblog-col-sm-6">
    <div class="eblog-single-inner style-12">
            <div class="icon-img">
               <img src="<?php echo esc_url( ele_blog_img_resize( $src[0], 370, 388, false ) ); ?>"
                alt="<?php echo esc_attr( $image_alt ); ?>">
            </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_date' ] ) : ?>
                            <li><i class="fa fa-clock"></i>
                                <?php the_time( get_option( 'date_format' ) ); ?>
                            </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 

            //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_date' ] ) : ?>
                            <li><i class="fa fa-clock"></i>
                                <?php the_time( get_option( 'date_format' ) ); ?>
                            </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; ?>

            <p><?php echo wp_trim_words( get_the_content(), $settings[ 'excerpt_length'] , '' ); ?></p>


        </div>
    </div>
</div>
<?php endwhile; wp_reset_postdata(); endif; ?>
</div>