ID;
$post_type = get_post_type($aelms_course_id);
if ($post_type === acadlix()->cpt()->course()->get_post_type()) {
$aelms_item = acadlix()->model()->course()->ofCourse()->find($aelms_course_id);
$aelms_type = 'course';
} elseif ($post_type === acadlix()->cpt()->course_bundle()->get_post_type()) {
$aelms_item = acadlix()->model()->courseBundle()->ofCourseBundle()->find($aelms_course_id);
$aelms_type = 'course_bundle';
}
$aelms_check_registration_date = acadlix()->helper()->course()->checkRegistrationDate(
$aelms_item->rendered_metas['start_date'] ?? null,
$aelms_item->rendered_metas['end_date'] ?? null
);
$aelms_enable_sale_price = $aelms_item->rendered_metas['enable_sale_price'] ?? false;
$aelms_sale_price = $aelms_item->rendered_metas['sale_price'] ?? 0;
$aelms_price = $aelms_item->rendered_metas['price'] ?? 0;
$aelms_is_course_purchased = false;
$aelms_cart = [];
if (is_user_logged_in()) {
$aelms_userId = get_current_user_id();
$aelms_is_course_purchased = $aelms_item->isPurchasedBy($aelms_userId);
$aelms_cart = acadlix()->model()->courseCart()->where([
['user_id', '=', $aelms_userId],
['item_id', '=', $aelms_item->ID],
['type', '=', $aelms_type]
])->first();
} else {
if (isset($_COOKIE['acadlix_cart_token'])) {
$aelms_cart = acadlix()
->model()
->courseCart()
->where('cart_token', sanitize_text_field(wp_unslash($_COOKIE['acadlix_cart_token'])))
->where('item_id', $aelms_item->ID)
->where('type', $aelms_type)
->first();
}
}
// echo "
";
// print_r();
// echo "";
ob_start();
include AELMS_PLUGIN_DIR . 'templates/list/course-card.php';
$aelms_course_card_html = ob_get_clean();
echo wp_kses_post($aelms_course_card_html);
?>
esc_url_raw(add_query_arg('current_page', '%#%')),
'format' => '',
'current' => max(1, $aelms_paged),
'total' => $aelms_the_query['course_count'] > 0 && $aelms_query_config['posts_per_page'] > 0 ? ceil($aelms_the_query['course_count'] / $aelms_query_config['posts_per_page']) : 1,
'type' => 'array',
'prev_text' => $aelms_display_config['pagination_previous_label'],
'next_text' => $aelms_display_config['pagination_next_label'],
);
// Adjust mid_size based on page_list_count setting
if ($aelms_display_config['pagination_type'] === 'numbers' || $aelms_display_config['pagination_type'] === 'number_prev_next') {
$aelms_paginate_args['mid_size'] = floor($aelms_display_config['pagination_page_limit'] / 2);
} else {
$aelms_paginate_args['mid_size'] = 0;
}
$aelms_links = paginate_links($aelms_paginate_args);
if (!empty($aelms_links)) {
?>