<?php

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

// override lifter template directory
add_filter( 'single_template', 'edumodo_lifter_course_load_template' );
function edumodo_lifter_course_load_template( $single_template ) {
	global $post;
	if('course' == $post->post_type && defined('LLMS_VERSION')){
		$single_template = get_template_directory() . '/template-parts/lifter/single/layout.php';
	}elseif('llms_quiz' == $post->post_type && defined('LLMS_VERSION')){
		$single_template = get_template_directory() . '/template-parts/lifter/single/quiz.php';
	}elseif('lesson' == $post->post_type && defined('LLMS_VERSION')){
		$single_template = get_template_directory() . '/template-parts/lifter/single/lesson.php';
	}elseif('llms_membership' == $post->post_type && defined('LLMS_VERSION')){
		$single_template = get_template_directory() . '/template-parts/lifter/single/membership.php';
	}
	return  $single_template;
}
/**
 * override 
 * lifterlms_loop_columns filter hooks
 */
add_filter( 'lifterlms_loop_columns', 'edumodo_change_lifter_course_archive_column' );
function edumodo_change_lifter_course_archive_column($cols){
	$lifter_course_archive_column  = get_theme_mod('edumodo_lifter_course_archive_column_count','3');
	$lifter_membership_archive_column  = get_theme_mod('edumodo_lifter_membership_archive_column_count','3');

	if(is_post_type_archive('course')){
		$cols = $lifter_course_archive_column ;
	}elseif (is_post_type_archive('llms_membership')) {
		$cols = $lifter_membership_archive_column ;
	}
    return $cols;
}