Shortcodes

Shortcodes

You can add shortcodes to the content area of any page or post in order to display specific content. For more on shortcodes and how to use them, please see WordPress Codex: Shortcodes.

Sensei provides the following shortcodes:

Courses

[sensei_courses] – A list of courses.

Option Description Values Default
category Show courses from a specific category Any valid course category ID, slug, or term name none (all categories)
exclude Specific course(s) to exclude from display Any valid course ID(s) (comma separated) none
ids Specific course(s) to display Any valid course ID(s) (comma separated) none (all courses)
number Number of courses to display Any valid number 10
order Sort order asc, desc desc (asc when orderby is menu_order)
orderby How to order the courses Any orderby parameter found here date
teacher Show courses from specific teacher(s) Any valid user ID(s) or user name(s) (comma separated) none (all teachers)

Example

[sensei_courses category="music" exclude="23" number="10" order="asc" orderby="name" teacher="123"]

Featured Courses

[sensei_featured_courses] – A list of featured courses.

Options

Option Description Values Default
number Number of featured courses to display Any valid number 10
order Sort order asc, desc desc (asc when orderby is menu_order)
orderby How to order the courses Any orderby parameter found here date
teacher Display only courses by a specific teacher User ID or user name none (all teachers)

Example

[sensei_featured_courses number="5" order="asc" orderby="name" teacher="123"]

Courses by User

[sensei_user_courses] – A list of courses the currently logged in user is taking.

Options

Option Description Values Default
number Number of courses to display per page Any valid number 10
order Sort order asc, desc asc
orderby How to order the courses Any orderby parameter found here title
status Whether to display active or completed courses active, complete no status (displays both active and completed)

Example

[sensei_user_courses number="5" order="desc" orderby="name" status="complete"]

Teachers

[sensei_teachers] – A list of users with the teacher role, displayed as links to their author archive page.

Options

Option Description Values Default
exclude Teachers to exclude Any valid user IDs or user names (comma separated) none (display all teachers)
include Teachers to include Any valid user IDs or user names (comma separated) none (display all teachers)

Example

[sensei_teachers exclude="23"]

User Messages

[sensei_user_messages] – A list of private Sensei messages for the current user.

Options

There are no options for this shortcode.

Course Page

[sensei_course_page] – Display the content of a specific course page by course ID.

Option Description Values Default
id (required) The ID of the course to display Any valid course ID none

Example

[sensei_course_page id="123"]

Course Categories

[sensei_course_categories] – A list of course categories.

Options

Option Description Values Default
exclude Specific course categories to exclude Any valid course category ID, slug, or term name (comma separated) none (display all)
hide_empty Display only categories containing at least one course true, false false
include Specific course categories to display Any valid course category ID, slug, or term name (comma separated) none (display all)
number Number of categories to display Any valid number 100
order Sort order asc, desc asc
orderby How to order the categories Any orderby parameter found here name
parent Display only categories with a specific parent Any valid course category ID. To show only top-level categories, set parent="0". none (display all)

Example

[sensei_course_categories exclude="music" hide_empty="true" order="desc" orderby="slug"]

Unpurchased Courses

[sensei_unpurchased_courses] – A list of all courses linked to a WooCommerce product that the current user has not yet purchased.

Options

Option Description Values Default
number Number of courses to display Any valid number 10
order Sort order asc, desc desc (asc when orderby is menu_order)
orderby How to order the courses Any orderby parameter value found here title

Example

[sensei_unpurchased_courses number="5" order="asc" orderby="date"]

Legacy Shortcodes

The following shortcodes were deprecated in Sensei 1.9 and should no longer be used:

[newcourses] – Displays the latest courses.
[featuredcourses] – Displays the courses marked as featured.
[freecourses] – Displays courses that do not require payment to take.
[paidcourses] – Displays courses that require payment to take.
[usercourses] – Displays the user’s active/completed courses or a login/register form if they are not logged in.

Finding the ID

In order to find the course ID to use for the [sensei_courses] or [sensei_course_page] shortcode, go to Courses > All Courses and edit the course you want to use. The URL will show a number that is the ID for your course (in the screenshot below, the course ID is 7707).

sensei-courseid

You can use a similar technique to find the course category ID or teacher ID.

Did you find this article useful?

  • Courses

    o add a course, go to Courses > Add New. You will see that some blocks have alread...
  • Modules

    Modules A module is a container for a group of lessons in a course. Conceptually, they exist as an...
  • Lessons

    Lessons To add a lesson, go to Lessons > Add New. You will see that some blocks ...
  • Quizzes

    Quizzes Quizzes are associated with an individual lesson. That means that in order to add a quiz, ...
  • Questions

    Questions Questions can be added in one of two ways – by going to Questions >&#...