Course Units

This filter will display a list of courses in the current category as a linked list, filtered to the courses that contain a specific custom attribute value. It automatically excludes a link to the current course.

It can display courses that have one of these custom attribute values:

  • Core
  • Elective
  • Optional
  • Introduction

It is a filter rather than a course format, activity type or block simply so that it can be used inside an activity such as a page or label. This is especially helpful for single-activity courses such as course homepages or standalone information pages.

The custom attribute value is currently hardcoded with the name ‘unittype’ of type ‘dropdown’ with the values shown in the list above in that order, but this will be made configurable in a future version.

Example scenario

Set up a single-activity course that is a page, then in the page description or content use the filter to link to your grouped courses. Use the shortcode shown below to list courses matching the attribute filter:

Welcome to the XYZ Doohickey Course. Click on the units below to get started.

Core units


Elective units



Each figure is rendered using the classnames ‘coursebox’ and the value of the custom attribute. For instance, <figure class='coursebox elective'>... This allows you to apply different styling based on the type of figure rendered. For instance, you could recolour the images based on the unit type:

/* assumes <div class='unit-list'>[[units::Core]]</div> */
.unit-list {
    display: grid;
    grid-template-columns: repeat(3,minmax(250px,1fr));
    grid-template-rows: auto;
    grid-template-areas: ". . .";
    width: 100%;
    gap: 1rem;
.unit-list>.elective img {
    filter: sepia(1) hue-rotate(135deg); /* blueish tint */
.unit-list>.core img {
    filter: sepia(1); /* yellowish tint */


You can download this plugin on my Github page.

Leave a comment