gocodebox / lifterlms

LifterLMS, a WordPress LMS Solution: Easily create, sell, and protect engaging online courses.
https://lifterlms.com
GNU General Public License v3.0
180 stars 134 forks source link

Add class to the current lesson in the Course Syllabus block #2777

Open brianhogg opened 5 days ago

brianhogg commented 5 days ago

Is your feature request related to a problem? Please describe. In older themes, using the Course Syllabus widget would add a current-lesson class on the current lesson. This lets the lesson be styled (ie. bolded) to show the student what lesson they are on. In the newer Course Syllabus block however this class (or a similar class) is not added.

Describe the solution you'd like Add a CSS class on the div for the lesson.

Describe alternatives you've considered There is a llms_get_preview_classes filter we could possibly use, which only passes in the $classes already generated currently. Or, creating a custom version of the lesson-preview.php template.

brianhogg commented 5 days ago

For some reason the global $post is the Course rather than the Lesson when the course syllabus is generating, so you can't do a if ( get_the_ID() === $this->get( 'id' ) ) within the LLMS_Lesson::get_preview_classes method.