LearnDash Shortcodes and How to Use Them
LearnDash comes with several shortcodes to use on your WordPress site. We have compiled a list of all the LearnDash shortcodes you can use and how you can use them. Additionally, we also feature a catalog of our own LearnDash shortcodes you can use to further expand your customization options.
What is a Shortcode?
A WordPress shortcode is essentially a “shortcut” to a specific function. The “shortcut” is wrapped in square brackets and displays the shortcode’s function on the front end of your page or post. Shortcodes allow users to execute specific functions without the need to embed technical code.
Table of Contents:
- Core LearnDash Shortcodes
- Conditionally Displayed Content Shortcodes
- LearnDash Certificate Shortcodes
- Additional Shortcodes for LearnDash
Core LearnDash Shortcodes
These LearnDash shortcodes are included with the installation of LearnDash.
|[ld_profile]||Displays basic user information (name, avatar, etc.), as well as total courses, course points, a list of enrolled courses, quiz results & certificates earned.|
|[ld_user_course_points]||Displays the earned course points, for that user, on any page.|
|[learndash_course_progress]||Displays a progress bar with the user’s progress for that course.|
|[ld_course_list]||Displays a list of courses. Many options are available to filter & customize the output. When the Course Grid add-on is enabled, it will display the courses in a grid layout.|
|[ld_lesson_list]||Similar to [ld_course_list] but displays a list of lessons. Also works with the Course Grid add-on.|
|[ld_topic_list]||Similar to [ld_course_list] but displays a list of topics. Also works with the Course Grid add-on.|
|[ld_quiz_list]||Similar to [ld_course_list] but displays a list of quizzes. Also works with the Course Grid add-on.|
|[ld_group_list]||Similar to [ld_course_list] but displays a list of groups. Also works with the Course Grid add-on.|
|[course_content]||Displays a complete list of all the course content including|
quizzes, lessons & topics related to a particular course.
|[user_groups]||Displays the list of the users assigned as either users or leaders.|
|[ld_video]||Displays a video anywhere within a lesson or topic page. You must be using video progression for this shortcode to work.|
|[ld_course_expire_status]||Displays the expiration date of a course for the current user.|
|[learndash_payment_buttons]||Shows the payment button for courses, anywhere on the page.|
|[ld_course_info]||Displays a list of registered courses, course progress details & all quizzes the user has taken.|
|[learndash_login]||The shortcode displays the LearnDash login and registration|
pop-up when clicked.
|[ld_matierials]||Displays the materials (if they exist) for the specified course, lesson, topic, or quiz.|
|[ld_certificate]||Displays a download link of an earned certificate.|
|[ld_course_resume]||Returns a user to the last step in the Course (format: link/button).|
|[ld_registration]||Displays the registration form when using LearnDash’s native registration/payment system.|
|[ld_infobar]||Displays the infobar for a LearnDash course.|
|[ld_navigation]||Displays the navigation for a LearnDash course or lesson.|
Conditionally Display Content
Show/hide content for certain LearnDash users and groups, as well as course progress.
|[visitor]||Displays content if a user is NOT enrolled in a course. Requires a closing [/visitor] tag.|
|[student]||Displays content if a user IS enrolled in a course. Can also be used to display content to individual users (based on user id). Requires a closing [/student] tag.|
|[course_notstarted]||Displays content if a user has access to a course, but has not completed any steps. Requires a closing [/course_notstarted] tag.|
|[course_inprogress]||Displays content if a user has access to a course, has completed at least one step, but has not finished the entire course. Requires a closing [/course_inprogress] tag.|
|[course_complete]||Displays content if a user has fully completed a course. Requires a closing [/course_complete] tag.|
|[ld_quiz_complete]||Displays content if a user has completed a quiz. Requires a closing [/ld_quiz_complete] tag.|
|[ld_group]||Displays a specified message to group enrollees. Requires specified group ID and a closing [/ld_group] tag.|
LearnDash Certificate Shortcodes
Used when creating LearnDash certificates. Display dynamic information about the LearnDash user and what course the certificate is being awarded for.
|[usermeta]||Displays information about the student, such as first name, last name or email address.|
|[courseinfo]||Displays course info (only works with certificates assigned to a course).|
|[quizinfo]||Displays various quiz info like the quiz title, timestamp, score, points awarded, etc.|
|[groupinfo]||Displays group info (only works with certificates assigned to a group).|
Each of these shortcodes comes with its own set of parameters that can be viewed here.
Additional Shortcodes for LearnDash
Course Grid Shortcode
|[ea_ld_course_grid]||This shortcode shows the LearnDash courses on the site in different styles depending on the templates, as well as with different extra functionalities.|
- Template: Choose between 6 layouts when displaying your LearnDash courses
- Columns: The number of columns to display the courses.
- Posts_per_page: How many courses can it show at a time before requesting more?
- Featured_courses: A parameter that makes the grid but instead of showing all courses, it just shows courses with the meta field “featured”.
Mini-Course Grid Shortcode
|[ea_ld_mini_course_grid]||This shortcode displays this list of courses in a small vertical format, very similar to how “related courses” appear on a Udemy course page.|
This shortcode features six template parameters to choose from.
Course Categories Shortcode
|[ea_ld_course_categories]||This shortcode displays the course categories in a grid with images. Images in course categories are NOT part of LearnDash. This is a new function added by the Additional Shortcodes plugin. |
When a user is creating/editing a LearnDash course category, they can now add a featured image like in posts/pages/products.
- with_links: (true/false) to have a link to a course category archive in each card.
Site Information Shortcodes
|[ea_author id=”x”]||Displays the name of the author of the post/page.|
|[ea_current_year]||Displays the current year.|
|[ea_site_title]||Displays the name of the site.|
LearnDash Specific Shortcodes
|[ea_ld_stats_points id=”x”]||Render a simple text with the number of points the user has.|
|[ea_ld_stats_certificates id=”x”]||Render a simple text with the number of certificates the user has.|
|[ea_ld_stats_enrolled id=”x”]||Renders a simple text with the number of enrolled courses the user is in.|
|[ea_ld_stats_completed id=”x”]||Renders a simple text with the number of courses the user has completed.|
|[ea_ld_stats_course_progress id=”x” course_id=”y” type=’percentage’]||Renders a simple text with the % of completion a user has with a course by course_id. The Type parameter by default is ‘percentage’, any other value will render “An out of ‘B’ steps”.|
|[ea_ld_user_avatar id=”x” type=”horizontal” size=”medium”]||Renders the avatar with the name of a user by id. Type can be ‘horizontal’ or ‘vertical’ (default). Size can be ‘tiny’, ‘small’ or ‘medium’ (default).|
|[ea_ld_stats_questions global=”true” course_id=”x” user_id=”y”]||Display the total number of questions of quizzes with some parameters.|
|[ea_ld_quiz_last_attempt quiz_id=”x” user_id=”y”]||Display the date of the last attempt by the user on a specific quiz.|
|[ea_ld_quiz_average course_id=”x” user_id=”y” type=”percentage”]||Display the average score by ‘type’ of attempted quizzes by the user_id in a course_id or globally.|
|[ea_ld_quiz_last_score user_id=” quiz_id=” course_id=” type=’percentage’]||Display the last score (points or percentage) of the last attempted quiz by a user.|
Course Content Shortcode
|[ea_ld_course_content]||Displays a course’s content (lessons, topics, etc) depending on a template style. It only has two parameters: course_id and template.|
LearnDash Course Price Shortcodes
|[ea_ld_course_price course_id=”x”]||Displays the price of a LearnDash course.|
|[ea_ld_course_price_discount course_id=”x” discount=”x”]||Displays the price of a LearnDash course with a manual discount attached to it if the user wants it, alongside a button.|
Product Star Rating Shortcode
|[ea_wc_star_rating product_id=”x”]||Displays the star rating of a WooCommerce product with a bunch of parameters.|
- product_id: Id of the product. Throws message of there is no product with that id.
- link: True/false. Whether to show as a hyperlink to the product itself. Default true.
- new_window: If there is a link, should it open in a new tab? Default true.
- no_rating_text: Text to show of there is no rating. Default is “Be first to rate ___”.
- show_rating_text: Whether to show the rating in a number or not. Default true.
- show_stars: (true/false) whether to show rating in Woocommerce stars or not. Default true.
- rating: To add a custom rating instead of the official product rating (a number between 0 and 5 e.g 2.5).
Looking for More Information?
Find out how to leverage our Additional Shortcodes for LearnDash plugin by viewing the plugin’s documentation.
To view our Additional Shortcodes in use, visit the plugin’s demo page.
Interested in Purchasing the Additional Shortcodes for LearnDash Plugin?
Click here for more information and pricing plans.
Become an Honors WP member to request features and receive beta access to unreleased features & plugins.