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

    $notice_archive_column = edumodo_get_theme_mod('edumodo_archive_notice_grid_column', '4');
    $notice_archive_card_image_size = edumodo_get_theme_mod('edumodo_notice_archive_image_size', 'tx_course_archive');
    $notice_archive_content = edumodo_get_theme_mod('edumodo_archive_notice_content_trigger', 'on');
    $notice_archive_content_length = edumodo_get_theme_mod('edumodo_notice_archive_content_length', 15);
    $notice_archive_date = edumodo_get_theme_mod('edumodo_archive_notice_date', 'on');
    $notice_archive_view_count = edumodo_get_theme_mod('edumodo_archive_notice_page_views', 'on');

?>

    <div class="col-md-<?php echo $notice_archive_column; ?> col-lg-<?php echo $notice_archive_column; ?> col-xs-12 col-sm-12">
        <div class="edumodo-notice-1">
            <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($notice_archive_card_image_size);?>
                        </a>
                    </figure>
                <?php endif; ?>

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

                        <header class="entry-header">
                            <h4 class="notice-entry-title">
                                <a href="<?php the_permalink();?>">
                                    <?php echo get_the_title(get_the_ID()); ?>
                                </a>
                            </h4>       
                        </header><!-- .entry-header -->
                        
                        <div class="entry-meta notice-meta">
                            <?php if( $notice_archive_date == 'on' ) :  ?>
                                <span class="post-date">
                                    <i class="fa fa-calendar"></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( $notice_archive_view_count == 'on' ) :  ?>
                                <span class="post-view">
                                    <i class="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($notice_archive_content == 'on'): 
                        if (!in_array(get_post_format(), $post_formats)):
                        ?>
                            <div class="entry-content">
                                <p><?php echo wp_trim_words( get_the_content(),$notice_archive_content_length, ''); ?></p>
                            </div><!-- .entry-content -->
                        <?php 
                        endif; 
                    endif; 
                    ?>

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