LLMS_Course::get_sections( string $return = 'sections' )
Get course sections
Parameters Parameters
- $return
-
(string) (Optional) Type of return [ids|posts|sections]. Default is 'sections'.
Default value: 'sections'
Return Return
(int[]|WP_Post[]|LLMS_Section[]) The type depends on value of $return.
Source Source
File: includes/models/model.llms.course.php
* @since 3.12.0
* @since 3.16.0 Unknown.
*
* @return int[] Array of WP_Post IDs of the quizzes.
*/
public function get_quizzes() {
$quizzes = array();
foreach ( $this->get_lessons( 'lessons' ) as $lesson ) {
if ( $lesson->has_quiz() ) {
$quizzes[] = $lesson->get( 'quiz' );
}
}
return $quizzes;
}
/**
* Get course sections
*
* @since 3.0.0
* @since 3.24.0 Unknown.
*
* @param string $return Optional. Type of return [ids|posts|sections]. Default is 'sections'.
* @return int[]|WP_Post[]|LLMS_Section[] The type depends on value of `$return`.
*/
public function get_sections( $return = 'sections' ) {
$q = new WP_Query(
array(
'meta_key' => '_llms_order',
'meta_query' => array(
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.24.0 | Unknown. |
| 3.0.0 | Introduced. |