Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. <?php // don't include this line in your functions.php file!
  2. /**
  3. * Get number of lessons attached to a course
  4. * @param int $course_id WP Post ID of a course
  5. * @return int
  6. */
  7. function my_get_lesson_count( $course_id ) {
  8.  
  9. $course = new LLMS_Course( $course_id );
  10. return count( $course->get_children_lessons() );
  11.  
  12. }
  13.  
  14.  
  15. // usage within a course
  16. echo my_get_lesson_count( get_the_ID() );
  17.  
  18. // usage outside a course
  19. $course_id = 123;
  20. echo my_get_lesson_count( $course_id );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement