Next

How to Customize WP Courses Course and Lesson Templates

WP Courses uses its own templates for course archives, single courses, course category archives, single lessons, teacher archives and single teacher pages.

Templates and template parts for WP Courses can be found in the “templates” and “template-parts” folders respectively.

WP Courses includes these templates using the “template_include” filter.

If you would like to use your own templates you can use the “template_include” filter in you own plugin, theme or functions.php file.

WARNING!

When you create your own template, please begin by copying and pasting all content from the respective default WP Courses template into your custom template.  Lesson tracking is called in the lesson template for example and failing to copy and paste the tracking functionality into your custom template will break lesson tracking.

 

Code 

[et_pb_dmb_code_snippet _builder_version=”4.6.5″ _module_preset=”default” hover_enabled=”0″ sticky_enabled=”0″ title=”How to Use Your Own Single Lesson Template” code=”YWRkX2ZpbHRlciggJ3RlbXBsYXRlX2luY2x1ZGUnLCAnd3BjX215X3NpbmdsZV9sZXNzb25fcGFnZV90ZW1wbGF0ZScsIDEwMCApOwoKZnVuY3Rpb24gd3BjX215X3NpbmdsZV9sZXNzb25fcGFnZV90ZW1wbGF0ZSggJHRlbXBsYXRlICkgewoJLy8gb25seSB1c2UgeW91ciBjdXN0b20gdGVtcGxhdGUgaWYgaXMgImxlc3NvbiIgcG9zdCB0eXBlIGFuZCBpcyBzaW5nbGUKICBpZiAoIGdldF9wb3N0X3R5cGUoKSA9PSAnbGVzc29uJyAmJiBpc19zaW5nbGUoKSApIHsKCQkvLyBwYXRoIHRvIHlvdXIgdGVtcGxhdGUKICAJJG5ld190ZW1wbGF0ZSA9ICdodHRwczovL215c2l0ZS5jb20vd3AtY29udGVudC90aGVtZXMvdHdlbnR5c2l4dGVlbi1jaGlsZC90ZW1wbGF0ZXMvd3BjLW15LXNpbmdsZS1sZXNzb24ucGhwJzsKCQkvLyBpZiB5b3VyIHRlbXBsYXRlIGlzbid0IGZvdW5kLCB1c2UgdGhlIGRlZmF1bHQgdGVtcGxhdGUKICAgIGlmICggIWVtcHR5KCAkbmV3X3RlbXBsYXRlICkgKSB7CiAgICAgICAgcmV0dXJuICRuZXdfdGVtcGxhdGU7CiAgICB9IAog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dmb_code_snippet _builder_version=”4.6.5″ _module_preset=”default” hover_enabled=”0″ sticky_enabled=”0″ title=”How to Use Your Own Single Course Template” code=”YWRkX2ZpbHRlciggJ3RlbXBsYXRlX2luY2x1ZGUnLCAnd3BjX215X3NpbmdsZV9jb3Vyc2VfcGFnZV90ZW1wbGF0ZScsIDEwMCApOwoKZnVuY3Rpb24gd3BjX215X3NpbmdsZV9jb3Vyc2VfcGFnZV90ZW1wbGF0ZSggJHRlbXBsYXRlICkgewoJLy8gb25seSB1c2UgeW91ciBjdXN0b20gdGVtcGxhdGUgaWYgaXMgImNvdXJzZSIgcG9zdCB0eXBlIGFuZCBpcyBzaW5nbGUKICBpZiAoIGdldF9wb3N0X3R5cGUoKSA9PSAnY291cnNlJyAmJiBpc19zaW5nbGUoKSApIHsKCQkvLyBwYXRoIHRvIHlvdXIgdGVtcGxhdGUKICAJJG5ld190ZW1wbGF0ZSA9ICdodHRwczovL215c2l0ZS5jb20vd3AtY29udGVudC90aGVtZXMvdHdlbnR5c2l4dGVlbi1jaGlsZC90ZW1wbGF0ZXMvd3BjLW15LXNpbmdsZS1jb3Vyc2UucGhwJzsKCQkvLyBpZiB5b3VyIHRlbXBsYXRlIGlzbid0IGZvdW5kLCB1c2UgdGhlIGRlZmF1bHQgdGVtcGxhdGUKICAgIGlmICggIWVtcHR5KCAkbmV3X3RlbXBsYXRlICkgKSB7CiAgICAgICAgcmV0dXJuICRuZXdfdGVtcGxhdGU7CiAgICB9IAogIH0gZWxzZSB7CgkJCS8vIGlmIGlzIG5vdCAiY291cnNlIiBwb3N0IHR5cGUgYW5kIGlzIG5vdCBzaW5nbGUgcG9zdCwgcmV0dXJuIGRlZmF1bHQgdGVtcGxhdGUKICAgIAlyZXR1cm4gJHRlbXBsYXRlOwogIH0KfQ==”]YWRkX2ZpbHRlciggJ3RlbXBsYXRlX2luY2x1ZGUnLCAnd3BjX215X3NpbmdsZV9jb3Vyc2VfcGFnZV90ZW1wbGF0ZScsIDEwMCApOwoKZnVuY3Rpb24gd3BjX215X3NpbmdsZV9jb3Vyc2VfcGFnZV90ZW1wbGF0ZSggJHRlbXBsYXRlICkgewoJLy8gb25seSB1c2UgeW91ciBjdXN0b20gdGVtcGxhdGUgaWYgaXMgImNvdXJzZSIgcG9zdCB0eXBlIGFuZCBpcyBzaW5nbGUKICBpZiAoIGdldF9wb3N0X3R5cGUoKSA9PSAnY291cnNlJyAmJiBpc19zaW5nbGUoKSApIHsKCQkvLyBwYXRoIHRvIHlvdXIgdGVtcGxhdGUKICAJJG5ld190ZW1wbGF0ZSA9ICdodHRwczovL215c2l0ZS5jb20vd3AtY29udGVudC90aGVtZXMvdHdlbnR5c2l4dGVlbi1jaGlsZC90ZW1wbGF0ZXMvd3BjLW15LXNpbmdsZS1jb3Vyc2UucGhwJzsKCQkvLyBpZiB5b3VyIHRlbXBsYXRlIGlzbid0IGZvdW5kLCB1c2UgdGhlIGRlZmF1bHQgdGVtcGxhdGUKICAgIGlmICggIWVtcHR5KCAkbmV3X3RlbXBsYXRlICkgKSB7CiAgICAgICAgcmV0dXJuICRuZXdfdGVtcGxhdGU7CiAgICB9IAogIH0gZWxzZSB7CgkJCS8vIGlmIGlzIG5vdCAiY291cnNlIiBwb3N0IHR5cGUgYW5kIGlzIG5vdCBzaW5nbGUgcG9zdCwgcmV0dXJuIGRlZmF1bHQgdGVtcGxhdGUKICAgIAlyZXR1cm4gJHRlbXBsYXRlOwogIH0KfQ==[/et_pb_dmb_code_snippet][et_pb_dmb_code_snippet _builder_version=”4.6.5″ _module_preset=”default” hover_enabled=”0″ sticky_enabled=”0″ title=”How to Use Your Own Archive Course Template” code=”YWRkX2ZpbHRlciggJ3RlbXBsYXRlX2luY2x1ZGUnLCAnd3BjX2FyY2hpdmVfY291cnNlX3BhZ2VfdGVtcGxhdGUnLCAxMDAgKTsKZnVuY3Rpb24gd3BjX2FyY2hpdmVfY291cnNlX3BhZ2VfdGVtcGxhdGUoICR0ZW1wbGF0ZSApIHsKICAgIGlmICggaXNfcG9zdF90eXBlX2FyY2hpdmUoICdjb3Vyc2UnICkpIHsKICAgICAgICAkbmV3X3RlbXBsYXRlID0gJ2h0dHBzOi8vbXlzaXRlLmNvbS93cC1jb250ZW50L3RoZW1lcy90d2VudHlzaXh0ZWVuLWNoaWxkL3RlbXBsYXRlcy93cGMtbXktYXJjaGl2ZS1jb3Vyc2UucGhwJzsKICAgICAgICBpZiAoICFlbXB0eSggJG5ld190ZW1wbGF0ZSApICkgewogICAgICAgICAgICByZXR1cm4gJG5ld190ZW1wbGF0ZTsKICAgICAgICB9IAogICAgfSBlbHNlIHsKICAgICAgICByZXR1cm4gJHRlbXBsYXRlOwogICAgfQp9″]YWRkX2ZpbHRlciggJ3RlbXBsYXRlX2luY2x1ZGUnLCAnd3BjX2FyY2hpdmVfY291cnNlX3BhZ2VfdGVtcGxhdGUnLCAxMDAgKTsKZnVuY3Rpb24gd3BjX2FyY2hpdmVfY291cnNlX3BhZ2VfdGVtcGxhdGUoICR0ZW1wbGF0ZSApIHsKICAgIGlmICggaXNfcG9zdF90eXBlX2FyY2hpdmUoICdjb3Vyc2UnICkpIHsKICAgICAgICAkbmV3X3RlbXBsYXRlID0gJ2h0dHBzOi8vbXlzaXRlLmNvbS93cC1jb250ZW50L3RoZW1lcy90d2VudHlzaXh0ZWVuLWNoaWxkL3RlbXBsYXRlcy93cGMtbXktYXJjaGl2ZS1jb3Vyc2UucGhwJzsKICAgICAgICBpZiAoICFlbXB0eSggJG5ld190ZW1wbGF0ZSApICkgewogICAgICAgICAgICByZXR1cm4gJG5ld190ZW1wbGF0ZTsKICAgICAgICB9IAogICAgfSBlbHNlIHsKICAgICAgICByZXR1cm4gJHRlbXBsYXRlOwogICAgfQp9[/et_pb_dmb_code_snippet][et_pb_dmb_code_snippet _builder_version=”4.6.5″ _module_preset=”default” hover_enabled=”0″ sticky_enabled=”0″ title=”How to Use Your Own Course Category Archive Template” code=”YWRkX2ZpbHRlciggJ3RlbXBsYXRlX2luY2x1ZGUn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