Action Since 3.0.0 uncanny-toolkit-pro

learndash-course-content-list-after

Fires before the course content listing. Fires after the course content listing is displayed, providing the course and user IDs.

add_action( 'learndash-course-content-list-after', $callback, 10, 2 );

Description

Fires after the course content listing has been displayed, but before the closing element. Developers can use this hook to add custom content, modify the surrounding structure, or perform actions after the course syllabus is rendered for a specific course and user.


Usage

add_action( 'learndash-course-content-list-after', 'your_function_name', 10, 2 );

Parameters

$course_id (int)
Course ID.
$user_id (int)
User ID.

Examples

/**
 * Add a custom note below the course content list for specific users.
 *
 * This function checks if the current user is an administrator. If so,
 * it displays a private note indicating that the admin is viewing the course content.
 * This is useful for debugging or checking the structure without triggering
 * learner-specific content or analytics.
 */
function my_learndash_admin_course_content_note( $course_id, $user_id ) {
    // Check if the current user is an administrator.
    if ( user_can( $user_id, 'manage_options' ) ) {
        echo '<div class="learndash-admin-note" style="border: 1px dashed #ccc; padding: 10px; margin-top: 15px; background-color: #f9f9f9;">';
        echo '<p><strong>Admin Note:</strong> You are viewing the content for Course ID: ' . esc_html( $course_id ) . '. Learner-specific elements may not be displayed.</p>';
        echo '</div>';
    }
}
add_action( 'learndash-course-content-list-after', 'my_learndash_admin_course_content_note', 10, 2 );

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/templates/single-ld30-course.php:300

* Fires before the course content listing.
			 *
			 * @since 3.0.0
			 *
			 * @param int $course_id Course ID.
			 * @param int $user_id   User ID.
			 */
			do_action( 'learndash-course-content-list-after', $course_id, $user_id );
			?>

		</div> <!--/.ld-item-list-->

		<?php
	endif;


Scroll to Top