Files
2026-04-23 04:33:43 +03:30

57 lines
1.7 KiB
PHP

<?php
/**
* Template part for displaying sfwd-courses content in archive.php.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Upstudy
* @since 1.0.0
*/
defined( 'ABSPATH' ) || exit();
use \Upstudy\Filter;
if ( ! isset( $get_options ) ) :
$get_options = array();
endif;
if ( ! isset( $style ) ) :
$style = Upstudy::setting( 'ld_course_archive_style' );
endif;
if ( isset( $_GET['course_preset'] ) ) :
$style = Filter::grid_layout_keys();
endif;
$default_data = array(
'style' => $style
);
$upstudy_course_container = array();
$masonry_status = Upstudy::setting( 'ld_course_masonry' );
$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-6 upstudy-col-md-6 upstudy-col-sm-12' ) );
endif;
$upstudy_course_container = array_merge( $upstudy_course_container, $column );
$args = wp_parse_args( $get_options, $default_data );
if ( have_posts() ) :
echo '<div class="' . esc_attr( $wrapper ) . '">';
while ( have_posts() ) : the_post();
?>
<div id="post-<?php the_ID(); ?>" <?php post_class( apply_filters( 'upstudy_course_loop_classes', $upstudy_course_container ) ); ?>>
<?php get_template_part( 'learndash/tpl-part/th-layout/layouts', '', $args );
echo '</div>';
endwhile;
echo '</div>';
else :
get_template_part( 'template-parts/content', 'none' );
endif;