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. Choose the Only run in administration area option (the screenshot above incorrectly shows “Run snippet everywhere”)
  6. 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


Now that you have the option, why don’t you learn how to create a custom course template with Elementor →

Previous

Design Upgrade Pro: LearnDash 3.0 Compatibility Is Here 🎉

Next

Create a Dark Mode for LearnDash Focus Mode

14 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.

  4. Tony

    Hi Dave! Thanks for the article. It seems to me I’m one step closer to my search – a way to build entirely custom Lesson Page layout templates for Learndash courses (preferrably using Elementor or Divi Page builder). Though I’m yet to understand to what extent your post can help me achieve this without seeing an example use case. Please, could you be kind enough to show even if it’s a sample custom lesson layout designed using Elementor? Thanks.

    PS: Do you take on Learndash template customization jobs? If yes, please could you let me know how to reach you to discuss. Thanks again.

    • Hey Tony,

      Yeah, this article was just meant to show people how to enable Elementor for LD courses/lessons, because it’s not as obvious as you would hope. But it doesn’t really dive into the specifics of how to achieve custom layouts. And there are still some things you can’t do with page builders, that require custom code.

      Yes, I do take on customization work. I’ll shoot you an email. Thanks.

  5. Melynda

    Hey, Dave. This works for me. Thank you so much!

    One question: when saving in Code Snippets, can we check “Run only in administration area” instead of “Run snippet everywhere?”

    Thanks again! You’re wonderful. 🙂

    • 😊

      Great question! Yes, absolutely. You should be able to just run it in the administration area… and that would be the best approach, as it’s not needed on the front-end of the site.

  6. Hi Dave – do I have to retype the code? I can’t find anywhere to copy from in your explanation.

  7. Embeth Andrews

    Hmm. I thought this worked, and it does…part way. Lesson and Topic both show up, but Course doesn’t, strangely enough. Any idea why that might be happening, Dave? I’m using PHP 7.3.14 on WordPress 5.3.2 using LearnDash 3.0.

    • You’ve enabled the course post type in the Elementor settings?

      If so, the only other thing I can think of is maybe you need a higher version of LearnDash. It’s possible you need LearnDash 3.1 or higher. I can’t remember which version I tested this with.

      Other than that, I don’t know 🤷‍♂️.

Leave a Reply

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

Powered by WordPress & Theme by Anders Norén