LMS & eLearning

Add Elementor Content Below LearnDash Lesson Content

Three ways to place extra content under every LearnDash lesson on an Elementor site: the lesson-after action, which fires in both lesson views, a saved template by ID, and the document itself.

Add Elementor Content Below LearnDash Lesson Content

A common request on LearnDash sites built with Elementor: show the same block of content under every lesson, such as a feedback form, a "need help" box or a related courses strip, without editing hundreds of lessons. There are three ways to do it, and which one fits depends on whether the lesson is rendered by LearnDash's template, by the LearnDash Elementor add-on's (1.0.9.1) view, or by an Elementor Theme Builder document. This snippet guide covers all three, with the hooks verified in the source.

Which template is rendering your lesson

With the LearnDash LD30 template, lesson pages are produced by themes/ld30/templates/lesson.php, which fires learndash-lesson-before at the top of the wrapper and learndash-lesson-after at the bottom, each with the lesson ID, course ID and user ID. When the Elementor add-on is active and a lesson has been edited with Elementor, the add-on swaps that template for its own lesson view through the learndash_template filter, and that view fires the same two actions with the same arguments. Topics have learndash-topic-after in both. So a hook on the after action covers lessons rendered either way.

The exception is a Single Lesson document from Elementor Pro's Theme Builder. Then the page body is the document, LearnDash's template is not used for the content area, and the after action does not fire; the add-on injects video, materials and access checks through a content filter instead, as described in building lesson templates with the Elementor add-on. For documents, use the third method below.

Method 1: hook the after action and render a saved template

Create the content once as a saved Elementor template under Templates, Saved Templates, note its ID, and render it with Elementor's frontend API:

<?php
/**
 * Render a saved Elementor template under every LearnDash lesson and topic.
 */
function wwc_learndash_step_footer( $step_id, $course_id, $user_id ) {
    $template_id = 1234; // Saved Elementor template ID.

    if ( ! class_exists( '\Elementor\Plugin' ) ) {
        return;
    }

    // Only for learners who can see the content.
    if ( ! sfwd_lms_has_access( $course_id, $user_id ) ) {
        return;
    }

    echo '<div class="ld-step-footer">';
    echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $template_id ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    echo '</div>';
}
add_action( 'learndash-lesson-after', 'wwc_learndash_step_footer', 10, 3 );
add_action( 'learndash-topic-after', 'wwc_learndash_step_footer', 10, 3 );

get_builder_content_for_display() returns the rendered template with its styles enqueued, so the section looks as it does in the editor. The access check keeps the footer away from visitors who see only the lesson's locked state; drop it if the footer is a sign-up prompt meant for exactly those visitors. The hook fires after the lesson's content, topic list, quiz list and comments area, immediately before the wrapper closes.

Method 2: plain HTML or a shortcode on the same hook

If the content is not an Elementor design, the same action can print a form shortcode or HTML:

<?php
add_action(
    'learndash-lesson-after',
    function ( $lesson_id, $course_id, $user_id ) {
        if ( empty( $user_id ) ) {
            return;
        }

        printf(
            '<aside class="ld-lesson-help"><h3>%s</h3>%s</aside>',
            esc_html__( 'Stuck on this lesson?', 'your-textdomain' ),
            do_shortcode( '[your_form_shortcode lesson="' . absint( $lesson_id ) . '"]' )
        );
    },
    10,
    3
);

Passing the lesson ID into the form shortcode is what makes the submissions useful; the hook gives you the IDs for free.

Method 3: inside an Elementor Theme Builder document

If lessons are rendered by a Single Lesson document, add the content directly to the document below the Course Content widget; it then appears on every lesson the document applies to, with conditions in the Theme Builder controlling which. Two add-on behaviours matter. First, on lessons the learner has not yet reached, the add-on blanks every widget except an allow-list, which includes the content, infobar, lists, login, payment and profile widgets but not standard Elementor widgets, so a footer made of text and image widgets is hidden on locked lessons by design; the access and progression guide explains the list and its filter. Second, the document's materials setting can append the lesson materials after the content, which is a built-in way to add per-lesson extra content without any code, covered in course materials in Elementor templates.

Choosing

  • Site uses the LD30 lesson template, or lessons are edited with Elementor individually: Method 1 or 2.
  • Site uses a Single Lesson document for all lessons: Method 3, or Method 1 if the same footer must also appear on lessons rendered outside the document.
  • Focus Mode is on: the LD30 template still fires the after action inside Focus Mode, since Focus Mode wraps the standard lesson template; Focus Mode and the Elementor add-on covers who renders what when both are on.

Content printed by the after action appears on the front end only, so editors do not see it when editing a lesson, and it cannot be accidentally deleted or moved per lesson. That is usually the point, but it also means a designer cannot restyle it in Elementor without editing the saved template, which is why Method 1 renders a saved template rather than hard-coded markup: the design stays editable in Elementor while the placement stays in code. If the footer needs per-lesson variation, store the variation as lesson meta and read it in the hook, rather than giving editors a way to switch the footer off per lesson, which tends to be forgotten.

Checking placement

Load a lesson as a learner and as a logged-out visitor. The footer should sit inside the learndash-wrapper element after the lesson's own sections. If it appears twice, the lesson is rendered by a document and you have also hooked the action through another route, or a page builder widget is also printing it. If it does not appear at all on a document-rendered lesson, that is expected for Methods 1 and 2; switch to Method 3. The Elementor add-on hooks reference lists the other hooks the add-on applies around lessons.

When to get help

A footer on every lesson is an hour's work with the snippet above. Per-course footers, footers that change with progress, or a help widget that opens a ticket pre-filled with lesson and course are small projects our LearnDash services team builds routinely; a LearnDash developer can also convert a library of individually edited lessons to one Theme Builder document so the footer lives in one place.

Frequently asked questions

Does learndash-lesson-after fire when the Elementor add-on is active?

Yes. The add-on's lesson view fires the same before and after actions as the LD30 template, with the same arguments.

Documents do not use the LearnDash lesson template, so the action never fires. Add the content to the document instead.

Yes. The hook receives the course ID; return early unless it is in your list.

Is there an equivalent hook for topics and quizzes?

Yes. Topics fire learndash-topic-after and quizzes fire learndash-quiz-after in the LD30 templates, each with the step, course and user IDs.

Add WorldWin Coder to your preferred sources

Add worldwincoder.com as a preferred source on Google, or open this article in your AI assistant to use it as a source.

· Developers and project managers

Articles written and reviewed by the developers and project managers at WorldWin Coder, who build and maintain websites, web applications and mobile apps on WordPress, Moodle, PHP, Laravel, CodeIgniter and Flutter.

Keep reading

Have something to build, fix or move?

Tell us where you are. A developer reads every inquiry, and you get next steps and a free quote within one business day.