<?php
/*
 * style five template
*/

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

    $src       = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full', false, '' );

    ?>
<div class="eblog-single-inner style-9">
    <div class="eblog-row">
        <?php if( 'left' == $settings[ 'imagealignment' ] ) : ?>
            <div class="eblog-col-sm-5">
                <div class="icon-img" style="background-image: url( <?php echo esc_url( $src[0] ); ?> );"></div>
            </div>
        <?php endif; ?>
        <div class="eblog-col-sm-7">

            <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; ?>

                <?php
                // 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>
         <?php if( 'right' == $settings[ 'imagealignment' ] ) : ?>
            <div class="eblog-col-sm-5">
                <div class="icon-img" style="background-image: url( <?php echo esc_url( $src[0] ); ?> );"></div>
            </div>
        <?php endif; ?>  
    </div>
</div>
<?php endwhile; wp_reset_postdata(); endif; ?>