LLMS_Shortcodes::course_info( array $atts )

Output various pieces of metadata about a course


Parameters Parameters

$atts

(array) (Required) Array of user-submitted shortcode attributes.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/shortcodes/class.llms.shortcodes.php

	 */
	public static function course_info( $atts ) {
		extract(
			shortcode_atts(
				array(
					'date_format' => 'F j, Y', // If $type is date, a custom date format can be supplied.
					'id'          => get_the_ID(),
					'key'         => '',
					'type'        => '', // Can either be: date, price or empty string.
				),
				$atts,
				'lifterlms_course_info'
			)
		);

		$ret = '';

		if ( $key ) {

			$course = new LLMS_Course( $id );

			switch ( $type ) {

				case 'date':
					$ret = $course->get_date( $key, $date_format );
					break;

				case 'price':
					$ret = $course->get_price( $key );
					break;

				default:
					$ret = $course->get( $key );

			}
		}

		/**
		 * Filters the course info shortcode output
		 *
		 * @since unknown
		 *
		 * @param string $ret  The shortcode output.
		 * @param array  $atts Associative array of shortcode attributes.
		 */
		return apply_filters( 'llms_shortcode_course_info', $ret, $atts );


Top ↑

Changelog Changelog

Changelog
Version Description
3.4.1 Unknown.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.