LMS & eLearning

Building a Custom LearnDash Template Set Beyond ld30

Register your own LearnDash template set next to ld30 and legacy: the LearnDash_Theme_Register API, where templates and assets are looked up, the fallback that surprises everyone, and when a set is worth it.

Building a Custom LearnDash Template Set Beyond ld30

LearnDash ships two template sets, which it calls themes: the original Legacy set and LearnDash 3.0, known by its key ld30. Most customisation happens by overriding individual ld30 files in your WordPress theme, as described in the template system guide. For agencies that build several academies with one design, or products that replace almost every template, there is another option: register a complete template set of your own that appears in LearnDash's Active Template setting. LearnDash 4.18.0.1 has a public registration API for this. This guide shows how to use it and points out the behaviours that are not obvious from the outside.

How template sets are registered

Template sets are subclasses of LearnDash_Theme_Register, defined in themes/class-ld-themes-register.php. Each subclass sets its properties in a protected constructor and registers an instance with the static add_theme_instance( $key ) method, during the learndash_themes_init action. LearnDash fires that action on after_setup_theme at priority 20, then loads the active set and its settings sections. The ld30 set registers itself exactly this way, from themes/ld30/includes/class-ld-themes-register.php.

The properties a set provides:

  • theme_key, the unique key used in paths and settings.
  • theme_name, the label shown in the Active Template dropdown.
  • theme_base_dir and theme_base_url, the folder holding the set.
  • theme_template_dir and theme_template_url, normally the templates subfolder.
  • supports_views, explained below.
  • theme_selectable, true by default, which controls whether it appears in the dropdown.
  • Optionally variations and default_variation; ld30 uses these for its Classic and Modern variations.

Two methods can be overridden: load_theme(), called only for the active set, to include its PHP helpers, and load_settings_sections(), to add settings sections of its own.

A minimal registration

Put the set in a plugin rather than a WordPress theme, so it survives theme changes:

<?php
/**
 * Plugin Name: WWC LearnDash Template Set
 */

add_action(
    'learndash_themes_init',
    function () {
        require_once __DIR__ . '/class-wwc-ld-theme.php';
        WWC_LD_Theme::add_theme_instance( 'wwc' );
    }
);
<?php
// class-wwc-ld-theme.php
class WWC_LD_Theme extends LearnDash_Theme_Register {

    protected function __construct() {
        $this->theme_key          = 'wwc';
        $this->theme_name         = esc_html__( 'WWC Academy', 'wwc' );
        $this->theme_base_dir     = __DIR__ . '/ld-theme';
        $this->theme_base_url     = plugins_url( 'ld-theme', __FILE__ );
        $this->theme_template_dir = $this->theme_base_dir . '/templates';
        $this->theme_template_url = $this->theme_base_url . '/templates';
        $this->supports_views     = false;

        parent::__construct();
    }

    public function load_theme() {
        // Reuse the ld30 helper functions that many templates call.
        include_once LEARNDASH_LMS_PLUGIN_DIR . 'themes/ld30/includes/helpers.php';
    }
}

Requiring the class file inside the action means LearnDash_Theme_Register already exists when PHP reads the subclass, and the set is never declared when LearnDash is inactive. After activation, the new set appears in the Active Template setting.

supports_views: the property you must set

The base class defaults supports_views to true. When the active set supports views, LearnDash renders course pages and several other screens through its newer view classes, such as Views\Course, which use templates under src/views, instead of calling course.php and the other classic templates. ld30 sets the property to false. If you want your set to work like ld30, with classic templates you can copy and edit, set it to false as in the example above. Leaving the default produces a set whose course page ignores your course.php, which is a confusing first result.

Where templates are looked up, and the fallback

SFWD_LMS::get_template_paths() builds the search list for each file. With your set active, it looks in this order:

  1. The WordPress theme, at learndash/wwc/{file}, child theme first.
  2. The uploads templates folder, under the key wwc.
  3. Your set's template folder.
  4. The Legacy set's template folder.

The last step is the surprise. A missing file does not fall back to ld30; it falls back to Legacy. A set that ships only course.php and a few modules will render everything else with Legacy markup, which looks nothing like ld30. If you want ld30 as the base, copy the complete themes/ld30/templates folder into your set and then change what you need. That also makes your set independent of future ld30 changes, which is the point of having one.

A folder named after a template is also accepted: if course.php is missing but a course directory exists, LearnDash loads course/index.php from it.

Helpers and assets

Many ld30 templates call functions such as learndash_get_template_part() and learndash_30_get_course_sections(). Those live in themes/ld30/includes/helpers.php, which ld30 only loads when it is the active set. Including that file from your load_theme() method, as in the example, makes them available. It also brings ld30's asset loader, which registers learndash-front from the active set's base URL, at assets/css/learndash.min.css, along with assets/js/learndash.js and the quiz stylesheet. Copy ld30's assets folder into your set, including the minified files, and edit the copies. If you prefer not to include the helpers, define the functions your templates use and enqueue your own assets on wp_enqueue_scripts.

One feature does not transfer: the login modal. learndash_load_login_modal_html() only prints it when the active template key is exactly ld30, so with your own set active the modal markup is never printed. Check what the login and enroll buttons in your templates do for visitors, and point them at a login page or print the modal template yourself.

Focus Mode works the same way. Its template_include handler is in the helpers file, and it looks for focus/index.php through the normal lookup, so your set needs its own focus folder. The Focus Mode templates are covered in overriding Focus Mode templates.

Settings for your set

ld30's colours, Focus Mode options and logo live in its settings section, stored under LearnDash_Settings_Theme_LD30. LearnDash loads the settings sections of every registered set, so those values remain readable, and code in the ld30 helpers reads them directly, which means they continue to apply when you include the helpers. The settings panel itself is shown expanded only for the active set, or for sets that ld30 lists as inheriting its settings, so editors may need to switch to ld30 briefly to change a colour, or you can expose the options elsewhere. For settings of your own, register a section in load_settings_sections() using LearnDash's settings section classes, or keep design choices in your theme's customiser. ld30 also declares get_themes_inheriting_settings(), which lets another set reuse its settings screen; that is used internally for the newer Breezy set.

Is a template set worth it?

For a single site, almost never. Overriding the ten or twenty ld30 files you actually change, in a child theme, is easier to maintain. A full set pays off when you deploy the same LearnDash design across many sites, when you sell a LearnDash theme product, or when your markup is so different that you would override most files anyway. The cost is that LearnDash updates to ld30 templates, including accessibility and security fixes, no longer reach your copies. Diff your set against each new ld30 release and port the changes that matter; our notes on update-safe customisations describe a workflow for that.

Testing

Switch the Active Template to your set on staging and walk through every LearnDash screen: course, lesson, topic, quiz with each question type, assignments, profile, course list, group pages, registration, login modal and certificates. Look for Legacy markup, which signals a missing file, and for PHP warnings about undefined functions, which signal a helper you have not loaded. Then switch back to ld30 and confirm nothing in your set leaks into it.

When to get help

Registering a set takes minutes; building and maintaining a complete one is a design and development project. Our UI and UX design and LearnDash development teams build branded LearnDash template sets, and a LearnDash developer can audit an existing set against the current ld30 release. More options are on our LearnDash services page.

Frequently asked questions

Why does my custom LearnDash template set show old-looking pages?

Missing files fall back to the Legacy template set, not to ld30. Copy the full ld30 templates folder into your set and edit from there.

Why is my course.php ignored?

The base class enables views by default, which renders the course page through LearnDash's newer view classes. Set supports_views to false in your constructor.

Can I override a custom set's templates from a WordPress theme?

Yes. LearnDash looks in the theme at learndash/{your-key}/ before your set's own folder, just as it does for ld30.

Do ld30 colour and Focus Mode settings still work?

They do if your set includes the ld30 helpers, which read those settings. Without the helpers you need your own implementation.

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.

Free consultation

Need help with LearnDash?

Tell us what you are working on. A developer who does this every week reads your message and replies within one business day with next steps and a free quote.

  • Free consultation and quote
  • NDA on request
  • You own the source code
  • Reply within one business day

Tell us about your project

Add budget and timeline optional, helps us quote faster

This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

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.