learndash-nav-widget-expand-class

apply_filters( 'learndash-nav-widget-expand-class',  string $expand_class,  int $lesson_id,  int $course_id,  int $user_id )

Filters the auto-expanding control of lessons in Focus Mode sidebar.


Description #


Parameters #

$expand_class

(string) Value will be 'ld-expanded' if it is a current lesson or an empty string.

$lesson_id

(int) Lesson Post ID. @since 3.1

$course_id

(int) Course Post ID. @since 3.1

$user_id

(int) User ID. @since 3.1


Source #

File: themes/ld30/templates/widgets/navigation/lesson-row.php


Examples #

 <?php
/**
 * Example usage for learndash-nav-widget-expand-class filter.
 */
add_filter(
	'learndash-nav-widget-expand-class',
	function( $is_expanded = '', $lesson_id = 0, $course_id = 0, $user_id = 0 ) {
		$is_expanded = '';

		// Always return $is_expanded.
		return $is_expanded;
	},
	30,
	4
);

add_filter(
	'learndash-nav-widget-expand-class',
	function( $expanded_class = '', $lesson_id = 0, $course_id = 0, $user_id = 0 ) {
		// keep all child steps expanded. To keep them closed always, change this to ''
		$expand_class = 'ld-expanded';

		return $expand_class;
	},
	10,
	4
);
 

Changelog #

Changelog
Version Description
3.0.0 Introduced.