Available Courses Shortcodes
What is a shortcode?
Shortcodes are small placeholders you can insert almost anywhere within your WordPress page and post content. When visitors view the page, those placeholders get processed and replaced with some dynamically generated content instead.
Currently Available Courses Shortcodes
MemberPress Courses plugin includes several shortcodes that allow you to display courses or sections on any post or page outside the default course page.
Here is the list of these shortcodes:
[mpcs-courses {parameters go here - see below}] Displays courses list with pagination. By default courses are displayed in 2 column layout with featured images, title, excerpt, author, lock icon for protected courses, and navigation. Displays courses list with pagination. By default, courses are displayed in 2 column layout with featured image, title, excerpt, author, lock icon for protected courses, and navigation.
All attributes below are optional.
- hide_cards - remove default card styling and display courses as a list - [mpcs-courses hide_cards="true"]
- show_3_col - display courses in 3-column layout - [mpcs-courses show_3_col="true"]
- hide_image - hide course featured image - [mpcs-courses hide_cards="true" hide_image="true"]
- hide_author - hide course author - [mpcs-courses hide_cards="true" hide_author="true"]
- hide_excerpt - hide course excerpt - [mpcs-courses hide_cards="true" hide_excerpt="true"]
- hide_lock_icon - hide lock icon that shows up next to course title for protected courses - [mpcs-courses hide_cards="true" hide_lock_icon="true"]
- hide_navigation - hide next/prev navigation that shows up at the bottom below courses - [mpcs-courses hide_cards="true" hide_navigation="true"]
[mpcs-my-courses {parameters go here - see below}] Displays courses list with pagination but only for logged-in users. The default number of courses is 6 per page, but you can change it by applying the mpcs_courses_per_page filter as it is explained here - mpcs_courses_per_page. Optionally, you can use one of the parameters below to display only courses with specific categories or tags:
- categories - the list of categories slugs separated by a comma. You can get the slugs when you go to Courses page in WordPress Dashboard and click on the Categories button at the top of the page
- tags - the list of tags slugs separated by a comma. You can get those slugs when you go to Courses page in the WordPress Dashboard and click on the Tags button at the top of the page
[mpcs-course-overview {parameters go here - see below}]
Displays the list of all sections and lessons from a specific course. It requires only one parameter from the list below:
- course_id - Course ID that you want to display. You can get this ID when you open the course in the WordPress Dashboard and check the number after the post parameter in the address bar. Where to find Course ID?
- lesson_id - Lesson ID from the course that you want to display. To get this ID open the lessons page using a similar link: https://your-domain.com/wp-admin/edit.php?post_type=mpcs-lesson (make sure to replace your-domain.com part with your domain name), click lesson, and check the number after post parameter in the address bar. Where to find Lesson ID?
- quiz_id - Quiz ID from the course that you want to display. To get this ID open the quizzes page using a similar link: https://your-domain.com/wp-admin/edit.php?post_type=mpcs-quiz (make sure to replace your-domain.com part with your domain name), click quiz, and check the number after post parameter in the address bar. Where to find Quiz ID?
An example shortcode might look like the following: [mpcs-course-overview course_id="710"]
[mpcs-section-overview lesson_id="869"]
Displays the list of lessons from a specific section. In order to select a section, you need to pass the lesson ID parameter from the section you want to display. To get lesson ID open the lessons page using a similar link: https://your-domain.com/wp-admin/edit.php?post_type=mpcs-lesson (make sure to replace your-domain.com part with your domain name), click lesson, and check the number after post parameter in the address bar. Where to find Lesson ID?
[mpcs-purchase-button membership_id="9" text="Enroll Now"]
Displays purchase button that will redirect users to a membership signup page taken from membership_id parameter. Where to find a Membership's ID?. Optionally, you can add a text parameter to change default "Enroll" button text.
[mpcs-certificate-link text="Download"]
Displays certificate link that allows users to download certificates when they complete the course. It is useful when Classroom mode is disabled to display certificate links. Optionally, a text parameter can be added to change default "Download Certificate" link text.
If you want to know more about shortcodes used in MemberPress, please check the list of available shortcodes.