LLMS_Track::get_courses()

Get an array of WP Posts for the courses in the track


Return Return

(array)


Top ↑

Source Source

File: includes/class.llms.track.php

	public function get_courses() {

		// No posts in the term, return an empty array.
		if ( 0 === $this->term->count ) {
			return array();
		}

		$q = new WP_Query(
			array(
				'post_status'    => 'publish',
				'post_type'      => 'course',
				'posts_per_page' => -1,
				'tax_query'      => array(
					array(
						'field'            => 'id',
						'include_children' => false,
						'taxonomy'         => $this->taxonomy,
						'terms'            => $this->term->term_id,
					),
				),
			)
		);

		if ( $q->have_posts() ) {
			return $q->posts;
		} else {
			return array();
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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