<?php
/**
 * The template for displaying archive pages
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package Edumodo
 */

$archive_txcourse_per_page = edumodo_get_theme_mod('edumodo_archive_txcourse_course_per_page', 6);

get_header(); ?>


<div id="primary" class="content-area">
    <main id="main" class="site-main">
        <div class="content-wrap">
          <div class="container">
              <div class="row">

                    <?php 
                        if ( have_posts() ) : 
                        $temp = $wp_query; 
                        $wp_query = null; 
                        $wp_query = new WP_Query(); 
                        $wp_query->query('showposts='."$archive_txcourse_per_page".'&post_type=tx-course'.'&paged='.$paged); 

                            while ($wp_query->have_posts()) : $wp_query->the_post(); ?>

                                  <?php  get_template_part( 'template-parts/content', 'tx-course');  ?>
                            <?php endwhile; wp_reset_postdata()?>

                                <div class="edumodo-pagination">
                                      <?php
                                        the_posts_pagination( array(
                                          'mid_size' => 1,
                                          'prev_text'          =>  '<i class="glyph-icon flaticon-left-arrow"></i>',
                                          'next_text'          =>  '<i class="glyph-icon flaticon-right-arrow"></i>',

                                        ) );
                                      ?>
                                </div>
                              
                      <?php 
                        $wp_query = null; 
                        $wp_query = $temp; 
                      ?>

                    <?php else:  ?>
                            <?php get_template_part( 'template-parts/content', 'none' ); 
                    endif; ?>

              </div><!-- .row -->
          </div><!-- .container -->
        </div>
    </main><!-- #main -->
</div><!-- #primary -->

<?php
get_footer();
