Files
Landing/wp-content/themes/upstudy/learnpress/archive-course.php
T
2026-04-23 04:33:43 +03:30

91 lines
2.8 KiB
PHP

<?php
/**
* Template for displaying content of single course.
*
* @author ThimPress
* @package LearnPress/Templates
* @version 4.0.0
*/
use \Upstudy\Filter;
get_header();
if ( ! isset( $layout_data ) ) :
$layout_data = array();
endif;
if ( ! isset( $style ) ) :
$style = Upstudy::setting( 'lp_course_archive_style' );
endif;
if ( isset( $_GET['course_preset'] ) ) :
$style = Filter::grid_layout_keys();
endif;
$default_data = array(
'style' => $style
);
$layout_data = wp_parse_args( $layout_data, $default_data );
$upstudy_course_container = array();
$masonry_status = Upstudy::setting( 'lp_course_masonry_layout' );
$wrapper = 'upstudy-lms-courses-grid upstudy-row upstudy-course-archive';
if ( $masonry_status || isset( $_GET['masonry'] ) ) :
$wrapper = $wrapper . ' ' . 'tpc-masonry-grid-wrapper';
$upstudy_course_container[] = 'tpc-masonry-item';
endif;
if ( ! isset( $column ) ) :
$column = apply_filters( 'upstudy_course_archive_grid_column', array( 'upstudy-col-lg-4 upstudy-col-md-6 upstudy-col-sm-12' ) );
endif;
if ( isset( $_GET['column'] ) ) :
if ( $_GET['column'] == 2 ) :
$column = array( 'upstudy-col-lg-6 upstudy-col-md-6 upstudy-col-sm-12' );
endif;
endif;
$upstudy_course_container[] = 'upstudy-course-style-' . esc_attr( $style );
$upstudy_course_container = array_merge( $upstudy_course_container, $column );
$args = array(
'post_type' => LP_COURSE_CPT,
'order' => 'DESC',
'paged' => get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1,
'posts_per_page' => LP()->settings->get( 'learn_press_archive_course_limit' )
);
$args = apply_filters( 'upstudy_lp_course_archive_args', $args );
$query = new WP_Query( $args );
echo '<div class="tpc-site-content-inner' . esc_attr( apply_filters( 'upstudy_container_class', ' upstudy-container' ) ) . '">';
do_action( 'upstudy_before_content' );
upstudy_lp_course_header_top_bar( $query );
if ( $query->have_posts() ) :
echo '<div class="' . esc_attr( $wrapper ) . '">';
while ( $query->have_posts() ) : $query->the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class( apply_filters( 'upstudy_course_loop_classes', $upstudy_course_container ) ); ?> data-sal>
<?php
learn_press_get_template( 'tpl-part/course/th-layouts.php', compact( 'layout_data' ) );
?>
</div>
<?php
endwhile;
wp_reset_postdata();
echo '</div>';
$GLOBALS['wp_query']->max_num_pages = $query->max_num_pages;
upstudy_numeric_pagination();
else :
_e( 'Sorry, No Course Found.', 'upstudy' );
endif;
do_action( 'upstudy_after_content' );
echo '</div>';
get_footer();