<?php
/**
 * Single Post.
 */
$confin_large_image =  wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'fullsize', false, '' );
$confin_large_image = $confin_large_image ? $confin_large_image[0] : '';
$image_alt = get_post_meta( $confin_large_image, '_wp_attachment_image_alt', true);
$confin_post_type = get_post_meta( get_the_ID(), 'post_type_metabox', true );
if ( ! empty( $confin_post_type['gallery_post_format'] ) ) {
  $post_format_class = ' slider-post';
} else {
  $post_format_class = ' ';
}
// Single Theme Option
$confin_post_pagination_option = cs_get_option('single_post_pagination');
$confin_single_featured_image = cs_get_option('single_featured_image');
$confin_single_author_info = cs_get_option('single_author_info');
$confin_single_share_option = cs_get_option('single_share_option');
?>
  <div  <?php post_class( esc_attr( 'clearfix post'.$post_format_class ) ); ?>>
  	<?php 
    if ( ! empty( $confin_post_type['gallery_post_format'] ) ) { ?>
    <div class="entry-media post-slider"
        data-nav="true"
        data-autoplay="true"
        data-auto-height="true"
        data-dots="true">
    <?php
      $confin_ids = explode( ',', $confin_post_type['gallery_post_format'] );
      foreach ( $confin_ids as $id ) {
        $confin_attachment = wp_get_attachment_image_src( $id, 'full' );
        $confin_alt = get_post_meta($id, '_wp_attachment_image_alt', true);
        echo '<img src="'. $confin_attachment[0] .'" alt="'. esc_attr( $confin_alt ) .'" />';
      }
    ?>
   </div>
  <?php } elseif ( $confin_large_image ) { ?>
  	  <div class="entry-media">
        <img src="<?php echo esc_url( $confin_large_image ); ?>" alt="<?php echo esc_attr( $image_alt ); ?>">
   		</div>
  	<?php	} ?>
    <ul class="meta">
        <li>
						<i class="ti-user"></i><?php printf(
						   '<span>'. esc_html__(' by','confin') .' <a href="%1$s" rel="author">%2$s</a></span>',
						  esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
						  get_the_author()
						); ?>
					</li>
        <li><i class="ti-calendar"></i><a href="<?php the_permalink(); ?>"><?php echo get_the_date(); ?></a></li>
        <li>
					<i class="ti-comment"></i><a class="confin-comment" href="<?php echo esc_url( get_comments_link() ); ?>">
						<?php printf( esc_html( _nx( 'Comment (%1$s)', 'Comments (%1$s)', get_comments_number(), 'comments title', 'confin' ) ), number_format_i18n( get_comments_number() ),'<span>' . get_the_title() . '</span>' ); ?>
					</a>
        </li>
    </ul>
    <div class="entry-details">
	     <?php
				the_content();
				echo confin_wp_link_pages();
			 ?>
    </div>
</div>
<?php if( has_tag() || ( $confin_single_share_option && function_exists('confin_wp_share_option') ) ) { ?>
<div class="tag-share">
	<?php
	$tag_list = get_the_tags();
	if( $tag_list ){
	?>
    <div class="tag">
        <i class="ti-folder"></i>
        <?php
				  if($tag_list) {
				  	echo the_tags( ' <ul><li>', '</li><li>', '</li></ul>' );
				 } ?>
    </div>
	 <?php
	 }
	if ( $confin_single_share_option && function_exists('confin_wp_share_option') ) {
		echo confin_wp_share_option();
	}
	?>
</div>
<?php
}
if( !$confin_single_author_info ) {
	confin_author_info();
	}
if( !$confin_post_pagination_option ){
		confin_single_pagination();
}


