dozent_get_course_price_type( null $course = null )

Get the course price type,


Description

If there is no price type, this function returns a default price type which will be dozent_course_access_methods(); first item

Example usage:

$price_type = dozent_get_course_price_type( $course );

See also


Parameters

$course

(null) (Optional)

Default value: null


Return

(mixed|void)


Source

File: includes/course-functions.php

	function dozent_get_course_price_type( $course = null ) {

		$course = get_post( $course );

		$access_methods = dozent_course_access_methods();

		$default_price_type = null;
		if ( dozent_count( $access_methods ) ) {
			$access_method_keys = array_keys( $access_methods ) ;
			$default_price_type = array_shift( $access_method_keys );
		}

		/**
		 * Filter the default course price type, return when price type is not set at the course.
		 *
		 * @since DozentLMS 1.0.0
		 *
		 * @param  string|null  $default_price_type
		 */

		$course_default_price_type = apply_filters( 'dozent_get_default_course_price_type', $default_price_type );

		$course_price_type = get_post_meta( $course->ID, '_course_price_type', true );

		if ( ! $course_price_type ) {
			$course_price_type = $course_default_price_type;
		}


		/**
		 * Filter the out of dozent_get_course_price_type(); function
		 *
		 * @since DozentLMS 1.0.0
		 *
		 * @param  string  $course_price_type  Course Price Type
		 * @param  int|object  $course  Post ID or Post Object
		 */

		return apply_filters( 'dozent_get_course_price_type', $course_price_type, $course );
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.