learndash_course_steps_expand_all

apply_filters( 'learndash_course_steps_expand_all',  boolean $expand_all,  int $course_id,  string $context )

Filters whether to expand all course steps by default. Default is false.


Description #


Parameters #

$expand_all

(boolean) Whether to expand all course steps.

$course_id

(int) Course ID.

$context

(string) The context where course is expanded.


Source #

File: themes/ld30/templates/course.php


Examples #

 <?php
/**
 * Example usage for learndash_course_steps_expand_all filter.
 */
add_filter(
	'learndash_course_steps_expand_all',
	function( $expand_lessons = false, $course_id = 0, $context = '' ) {

		// Example 1: Simple Example don’t care about $course_id or $context
		$expand_lessons = true;

		// Example 2: Expand only on $course_id match
		// if ( $course_id == 123 ) {
		// $expand_lessons = true;
		// }

		// Example 3: Expand only when $context is the main course page 'course_lessons_listing_main'.
		// if ( $context == 'course_lessons_listing_main' ) {
		// $expand_lessons = true;
		// }

		// Example 4: Combined $course_id and $context
		// if (( $course_id == 123 ) && ( $context == 'course_lessons_listing_main' )) {
		// $expand_lessons = true;
		// }

		// Always return $expand_lessons
		return $expand_lessons;
	},
	10,
	3
);