How can I create custom template for course units?
The easiest way to create a custom course unit template would be to take your theme's single.php template file and make a copy, then modify the HTML elements within the template to meet the desired look. Once that's complete there are two methods for applying this template to course units.
- The first method would be to apply the template globally to all course units. To do so, you would simply need to name the file single-course_unit.php. The template will then be applied to all course units globally.
- The second method is to create the template that you can apply to specific course units. To do so, you'll need to copy the header below and apply it to the header of the new template file. You can change the name to anything you'd like. Then with in the course unit, you'll need to find the Course Unit Template metabox (see example below). The template will appear in the drop down and you can pick the template that you'd like to apply to the course unit.
<?php /** * Unit Template Name: Full-width course unit
[NOTE] - If you set a global template file, and then create individual templates to apply to certain course units, the individual templates will take precedence over the global template. Also, the custom header is not required for the global template.