LDX Design

LearnDash Design & Tutorials

LearnDash post types in Elementor single template

How to Enable Elementor Templates for LearnDash Courses, Lessons & Topics

The Elementor page builder recently passed the 3 million active install mark, making it arguably the most popular WordPress page builder out there. And for good reason.

It can be a powerful tool for designing beautiful landing pages, including those used in your online courses. Since LearnDash doesn’t provide much in the way of design for course, lesson & topic pages, Elementor is a great tool to use alongside LearnDash.

The Big Problem: Why can’t you select the course, lesson or topic post type when creating a “Single” Elementor template with the Theme Builder?

Thankfully, there’s a fairly easy solution. I’ll explain the two main steps below.

Step 1: Enable LearnDash Post Types in Elementor Settings

First, you need to make sure the LearnDash post types are enabled in your Elementor settings.

LearnDash post types in Elementor settings

  1. Navigate to Elementor > Settings
  2. On the “General” tab, in the “Post Types” section, look for the LearnDash post types
  3. Make sure the boxes are checked for Courses, Lessons & Topics (Quizzes, Essays & Assignments are also available)
  4. Click Save Changes at the bottom

For most other plugins & custom post types, this will be all that is needed. However, LearnDash post types are set up a bit differently, and Elementor still doesn’t recognize them as being available to use with Theme Builder templates. So…

Step 2: Add a Custom Code Snippet

This code snippet is provided by LearnDash, and it makes a slight change to how LearnDash post types are registered. Essentially, it adds the feature that Elementor needs in order to use courses, lessons & topics as single templates in Elementor.

Get the code snippet →

Where to put the code

My recommendation is to use the Code Snippets plugin. This plugin allows you to run custom code snippets as if they were placed in your child theme’s functions.php file. But you don’t have to worry about potentially messing something up in that file, as it is crucial to your site’s well-being. One tiny error in that file and your entire site could go down.

Code snippet to enable LearnDash post types in Elementor theme builder

  1. Install & activate “Code Snippets” from your WordPress plugins page
  2. Navigate to Snippets > Add New in the left sidebar
  3. Give your snippet a name. Something like “Elementor – Enable LearnDash Post Types.”
  4. Paste the code snippet into the Code area
  5. Click the Save Changes and Activate button

NOTE
I think you need to be using LearnDash 3.0 or higher for this to work. I tried it with LearnDash 2.6.6 and it didn’t work for me.

Per the comments below, it also looks like you need to be using PHP 7.3 or higher.

Now return to the Elementor Theme Builder and add a new template. Select the “Single” template type, and then you should see courses, lessons & topics available in the post type dropdown.

LearnDash post types in Elementor single template

Previous

Design Upgrade Pro: LearnDash 3.0 Compatibility Is Here 🎉

Next

Create a Dark Mode for LearnDash Focus Mode

6 Comments

  1. Dran

    Doesn’t work. Site directly crash in funtions.php and with code snippet

    • Hi Dran — Sorry it’s not working for you. It worked for me a few weeks ago. It’s possible LearnDash has made some changes. If you copied the code exactly and it’s not working, you should reach out to LearnDash support.

  2. Dran

    LearnDash say me the same thing …

    • Dran

      Voilà la réponse. Il faut etre IMPERATIVEMENT en PHP 7.3 minimum
      Cordialement

  3. It is not working while using the functions.php file and gives the error of 404.

    • Per Dran’s comment above, it looks like you might need to be using PHP 7.3 or higher for this to work. If this is something you absolutely need, try updating your PHP version to 7.3.

Leave a Reply

Your email address will not be published. Required fields are marked *

Powered by WordPress & Theme by Anders Norén