LLMS_Section::get_lessons( string $return = 'lessons' )

Get all lessons in the section


Description Description


Parameters Parameters

$return

(string) (Optional) Type of return [ids|posts|lessons]. Default is lessons.

Default value: 'lessons'


Top ↑

Return Return

(int[]|WP_Post[]|LLMS_Lesson[]) Return ty depends on value of $return argument.


Top ↑

Source Source

File: includes/models/model.llms.section.php

	public function get_lessons( $return = 'lessons' ) {

		$query = new WP_Query(
			array(
				'meta_key'       => '_llms_order',
				'meta_query'     => array(
					array(
						'key'   => '_llms_parent_section',
						'value' => $this->get( 'id' ),
					),
				),
				'order'          => 'ASC',
				'orderby'        => 'meta_value_num',
				'post_type'      => 'lesson',
				'posts_per_page' => 500,
			)
		);

		if ( 'ids' === $return ) {
			$ret = wp_list_pluck( $query->posts, 'ID' );
		} elseif ( 'posts' === $return ) {
			$ret = $query->posts;
		} else {
			$ret = array_map( 'llms_get_post', $query->posts );
		}

		return $ret;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.3.0
3.24.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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