<?php
/**
 * Template part for displaying course
  posts.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package Edumodo
 */

    $txcourse_archive_column = edumodo_get_theme_mod('edumodo_archive_txcourse_course_grid_column', '4');
    $txcourse_archive_card_image_size = edumodo_get_theme_mod('edumodo_txcourse_archive_image_size', 'tx_course_archive');
    $txcourse_archive_date = edumodo_get_theme_mod('edumodo_archive_txcourse_date', 'on');
    $txcourse_archive_view = edumodo_get_theme_mod('edumodo_archive_txcourse_view', 'on');
    $txcourse_archive_content = edumodo_get_theme_mod('edumodo_archive_txcourse_content', 'on');
    $txcourse_archive_content_length = edumodo_get_theme_mod('edumodo_archive_txcourse_content_length', '4');

?>

    <div class="edumodo-course-1">
        <div class="col-md-<?php echo $txcourse_archive_column; ?> col-lg-<?php echo $txcourse_archive_column; ?> col-xs-12 col-sm-6">
            <article id="post-<?php the_ID(); ?>" <?php post_class('custom-post'); ?>>

                <?php if ( has_post_thumbnail() ):?>
                    <figure class="post-thumbnail">
                        <a href="<?php the_permalink(); ?>">
                            <?php the_post_thumbnail($txcourse_archive_card_image_size );?>
                        </a>
                    </figure>
                <?php endif; ?>

                <div class="course-details">
     
                    <?php if ( 'tx-course' === get_post_type() ) : ?>

                        <header class="entry-header">
                            <h4 class="course-entry-title">
                                  <a href="<?php the_permalink();?>">
                                    <?php echo get_the_title(get_the_ID()); ?>
                                  </a> 
                            </h4>       
                        </header><!-- .entry-header -->
                        
                        <div class="entry-meta course-meta">
                            <?php if ($txcourse_archive_date == 'on'): ?>
                                <span class="post-date">
                                  <i class="glyph-icon flaticon-calendar-with-spring-binder-and-date-blocks"></i> 
                                   <?php 
                                        $archive_year  = get_the_time('Y'); 
                                        $archive_month = get_the_time('m'); 
                                        $archive_day   = get_the_time('d'); 
                                    ?>
                                    <a href="<?php echo get_day_link( $archive_year, $archive_month, $archive_day); ?>"><?php echo get_the_date(); ?></a>
                                </span>
                             <?php endif ?>
                             <?php if ($txcourse_archive_view == 'on'): ?>
                                <span class="post-view">
                                    <!-- <i class="glyph-icon flaticon-binoculars"></i>  -->
                                    <i class="glyph-icon fa fa-eye"></i> 
                                    <?php echo getPostViews(get_the_ID()); ?>
                                </span>      
                             <?php endif ?>
                        </div><!-- .entry-meta -->
                    <?php endif; ?>
                
                    <?php  
                    $post_formats = array('audio', 'image', 'video', 'link', 'gallery'); 
                    if ($txcourse_archive_content == 'on'):
                    if (!in_array(get_post_format(), $post_formats)):?>
                        <div class="entry-content">
                            <p><?php echo wp_trim_words( get_the_excerpt(), $txcourse_archive_content_length, ''); ?></p>
                        </div><!-- .entry-content -->
                    <?php endif; ?>
                    <?php endif; ?>

                </div><!-- .course details -->
            </article><!-- #post-## -->
        </div> <!-- /.col-md-4 -->

    </div> <!-- /.section -->



		
