Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php // don't include this line in your functions.php file!
- /**
- * Get number of lessons attached to a course
- * @param int $course_id WP Post ID of a course
- * @return int
- */
- function my_get_lesson_count( $course_id ) {
- $course = new LLMS_Course( $course_id );
- return count( $course->get_children_lessons() );
- }
- // usage within a course
- echo my_get_lesson_count( get_the_ID() );
- // usage outside a course
- $course_id = 123;
- echo my_get_lesson_count( $course_id );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement