<?php
/**
 * Template part for displaying posts
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package Edumodo
 */
    $post_id = edumodo_get_id();
    // Prefix
    $prefix = '_edumodo_';

	$archive_content_type   = edumodo_get_theme_mod('edumodo_archive_post_content_type', 'excerpt');
	$excerpt_length   = edumodo_get_theme_mod('edumodo_blog_style_post_excerpt_length', 30);


?>

<article id="post-<?php the_ID(); ?>" <?php post_class('main-post'); ?>>
	<?php if ( has_post_thumbnail() ):?>
	<div class="edumodo-post-img">
		<a href="<?php the_permalink(); ?>">
			<?php the_post_thumbnail();?>
		</a>
		<?php if(is_sticky()): ?>
			<div class="post-triangle">
				<span>
					<i class="glyph-icon flaticon-star"></i>
				</span>
			</div>
		<?php endif; ?>	
	</div>
	<?php endif; ?>	
	<div class="entry-content">
		<?php if ( 'post' === get_post_type() ) : ?>
			<div class="entry-meta">
				<ul>
					<li><i class="fa fa-user"></i><?php echo get_the_author();?></li>
					<li><i class="fa fa-calendar"></i><?php echo get_the_date(); ?></li>
					<li>
						<?php if ( 'post' === get_post_type() ) {
						$categories_list = get_the_category_list(esc_html__(', ', 'edumodo'));
							if ($categories_list) {
								printf('<span class="cat-links"><i class="fa fa-tags"></i>' . esc_html__('%1$s', 'edumodo') . '</span>', $categories_list);
							}
						} 
						?>
					</li>
				</ul>
			</div>
		<?php endif; ?>
		<h2 class="entry-title">
			<a href="<?php the_permalink();?>">
				<?php the_title(); ?>
			</a>
		</h2>
		<?php if($archive_content_type == 'excerpt'): ?>
			<p class="content-excerpt"><?php echo wp_trim_words( get_the_content(get_the_ID()), $excerpt_length, ''); ?></p> 
		<?php else: ?>
			<p><?php echo  get_the_content(get_the_ID()); ?></p>
		<?php endif; ?>
		<div class="readmore-btn">
			<a href="<?php the_permalink(); ?>"><?php esc_html_e('Read More', 'edumodo');?><i class="glyph-icon flaticon-right-arrow"></i></a>
		</div> 
	</div>
</article>
