Shortcodes
Classerna provides shortcodes to display course content anywhere on your site. Use these in pages, posts, or widget areas.
My Courses Shortcode
[idcms_my_courses]
Displays a list of courses the logged-in user is enrolled in. This shortcode is automatically added to the "My Courses" page created during plugin activation.
Usage
- Create a new page or edit an existing one.
- Add the shortcode
[idcms_my_courses]to the content. - Publish or update the page.
Features
- Course List - Shows all enrolled courses with thumbnails
- Course Drilldown - Click a course to see sessions and materials
- Session Details - View individual sessions with materials access
- Search & Filter - Filter enrolled courses by name or category
Logged Out State
If a visitor is not logged in, the shortcode displays a message prompting them to log in, with a link to the WordPress login page.
Parameters
This shortcode does not accept any parameters. It automatically displays courses for the currently logged-in user.
Course List Shortcode
[idcms_courses]
Displays a list or grid of courses. Use this to embed courses on any page.
Parameters
| Parameter | Default | Description |
|---|---|---|
limit |
-1 (all) | Number of courses to display |
category |
(none) | Filter by category slug |
difficulty |
(none) | Filter by difficulty level slug |
orderby |
date | Sort by: date, title, menu_order |
order |
DESC | Sort order: ASC or DESC |
columns |
3 | Number of columns in grid (1-4) |
Examples
Display 6 courses in 3 columns
[idcms_courses limit="6" columns="3"]
Display photography courses only
[idcms_courses category="photography"]
Display beginner courses sorted by title
[idcms_courses difficulty="beginner" orderby="title" order="ASC"]
Display 4 featured courses in 2 columns
[idcms_courses limit="4" columns="2"]
Single Course Shortcode
[idcms_course id="123"]
Displays a single course's information. Useful for featuring a specific course on a landing page or within a blog post.
Parameters
| Parameter | Required | Description |
|---|---|---|
id |
Yes | The course post ID |
show_sessions |
No | Show sessions list: "yes" or "no" (default: "yes") |
show_registration |
No | Show registration section: "yes" or "no" (default: "yes") |
Finding the Course ID
- Go to Classerna > All Courses.
- Hover over the course name.
- Look at the URL in your browser status bar or click "Edit".
- The ID is the number after
post=in the URL.
Examples
Display full course details
[idcms_course id="42"]
Display course without sessions
[idcms_course id="42" show_sessions="no"]
Display course info only (no registration)
[idcms_course id="42" show_registration="no"]
Using Shortcodes in Gutenberg
To add a shortcode in the block editor:
- Click the + (Add Block) button.
- Search for "Shortcode".
- Add the Shortcode block.
- Paste your shortcode into the block.
Using Shortcodes in Classic Editor
Simply paste the shortcode directly into the editor content area where you want it to appear.
Using Shortcodes in Widgets
Add shortcodes to widget areas using the Text widget or Custom HTML widget:
- Go to Appearance > Widgets.
- Add a Text or Custom HTML widget to your desired area.
- Paste the shortcode.
- Save the widget.
[idcms_courses limit="3" columns="1"] to display a compact list of courses.