LLMS_Shortcode_Courses::get_output()

Retrieve the actual content of the shortcode


Description Description

$atts & $content are both filtered before being passed to get_output() output is filtered so the return of get_output() doesn’t need its own filter.


Top ↑

Return Return

(string)


Top ↑

Source Source

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

	protected function get_output() {

		$this->enqueue_script( 'llms-jquery-matchheight' );

		ob_start();

		// If we're outputting a "My Courses" list and we don't have a student output login info.
		if ( 'no' !== $this->get_attribute( 'mine' ) && ! llms_get_student() ) {

			printf(
				__( 'You must be logged in to view this information. Click %1$shere%2$s to login.', 'lifterlms' ),
				'<a href="' . llms_get_page_url( 'myaccount' ) . '">',
				'</a>'
			);

		} else {

			if ( 'no' !== $this->get_attribute( 'mine' ) && ! $this->get_post__in() ) {

				printf( '<p>%s</p>', __( 'No courses found.', 'lifterlms' ) );

			} else {

				lifterlms_loop( $this->get_wp_query() );

			}
		}

		return ob_get_clean();

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.30.2 Output a message instead of the entire course catalog when "mine" is used and and current student is not enrolled in any courses.
3.14.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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