HEX
Server: LiteSpeed
System: Linux s166.bitcommand.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User: h340499 (1922)
PHP: 8.2.16
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/h340499/public_html/wp-content/plugins/learnpress/templates/single-course.php
<?php
/**
 * Template for displaying content of single course.
 *
 * @author  ThimPress
 * @package LearnPress/Templates
 * @version 4.0.1
 */

defined( 'ABSPATH' ) || exit;

/**
 * Header for page
 */
if ( ! wp_is_block_theme() ) {
	do_action( 'learn-press/template-header' );
}

/**
 * @since 3.0.0
 */
do_action( 'learn-press/before-main-content' );
do_action( 'learn-press/before-main-content-single-course' );

// WP 6.4 with Block theme can't detect single course, so code while ( have_posts() ) not run.
$args = array(
	'name'        => get_query_var( LP_COURSE_CPT ),
	'post_type'   => LP_COURSE_CPT,
	'numberposts' => 1,
	'post_status' => 'any',
);

// Fix preview course
if ( isset( $_REQUEST['preview'] ) &&
	( isset( $_REQUEST['p'] ) || isset( $_REQUEST['preview_id'] ) ) ) {
	unset( $args['name'] );
	$args['include'] = isset( $_REQUEST['p'] ) ? [ (int) $_REQUEST['p'] ] : [ (int) $_REQUEST['preview_id'] ];
}

$posts = get_posts( $args );
$post  = $posts[0] ?? 0;

if ( $post instanceof WP_Post ) {
	if ( $post->post_status !== 'publish'
		&& ( ! current_user_can( ADMIN_ROLE ) && get_current_user_id() != $post->post_author ) ) {
		$template_404 = get_query_template( '404' );
		if ( $template_404 ) {
			include $template_404;
		}
	} else {
		learn_press_get_template( 'content-single-course' );
	}
}
/*while ( have_posts() ) {
	the_post();
	learn_press_get_template( 'content-single-course' );
}*/

/**
 * @since 3.0.0
 */
do_action( 'learn-press/after-main-content-single-course' );
do_action( 'learn-press/after-main-content' );

/**
 * LP sidebar
 */
do_action( 'learn-press/sidebar' );

/**
 * Footer for page
 */
if ( ! wp_is_block_theme() ) {
	do_action( 'learn-press/template-footer' );
}