Home / Shortcodes

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

  1. Create a new page or edit an existing one.
  2. Add the shortcode [idcms_my_courses] to the content.
  3. Publish or update the page.

Features

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.

📸
My Courses Page
Screenshot of the My Courses page showing enrolled courses in a card layout with course images, titles, and "View Course" buttons.
images/shortcode-my-courses.png

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"]
📸
Course List Shortcode
Screenshot of a page with the courses shortcode showing a 3-column grid of course cards.
images/shortcode-courses.png

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

  1. Go to Classerna > All Courses.
  2. Hover over the course name.
  3. Look at the URL in your browser status bar or click "Edit".
  4. The ID is the number after post= in the URL.
📸
Finding Course ID
Screenshot of the course list with URL visible showing "post=123" with the number highlighted.
images/finding-course-id.png

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:

  1. Click the + (Add Block) button.
  2. Search for "Shortcode".
  3. Add the Shortcode block.
  4. Paste your shortcode into the block.
📸
Shortcode in Gutenberg
Screenshot of the Gutenberg editor with a Shortcode block containing the [idcms_my_courses] shortcode.
images/shortcode-gutenberg.png

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:

  1. Go to Appearance > Widgets.
  2. Add a Text or Custom HTML widget to your desired area.
  3. Paste the shortcode.
  4. Save the widget.
Tip: For sidebars, consider using [idcms_courses limit="3" columns="1"] to display a compact list of courses.