Additional Shortcodes for LearnDash – Specific Shortcodes
These LearnDash shortcodes are meant to break existing LearnDash shortcodes into small bits.
Statistics Shortcodes #
[ea_ld_stats_points id="x"]
Render a simple text with the number of points the user has. Current logged-in user by default.
[ea_ld_stats_certificates id="x"]
Render a simple text with the number of certificates the user has. Current logged-in user by default.
[ea_ld_stats_enrolled id="x"]
Renders a simple text with the number of enrolled courses the user is in. Current logged-in user by default.
[ea_ld_stats_completed id="x"]
Renders a simple text with the number of courses the user has completed. Current logged-in user by default.
[ea_ld_stats_course_progress id="X" course_id="Y" type='percantage']
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”. See examples below.
[ea_ld_stats_questions global="true" course_id="x" user_id="y"]
Display the total number of questions of quizzes with some parameters:
- global (false by default): if true, it will just display the number of questions on all quizzes or on quizzes that are part of a course (course_id)
- course_id: to count questions on quizzes that are part of a course. (optional)
- user_id: to show the number of questions of all attempted quizzes the user has done. In general or attempted quizzes that are part of a specific course by course_id.
User Avatar Shortcode #
ea_ld_user_avatar id="X" type="horizontal" size="medium"
Renders a 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).
Quiz Shortcodes #
ea_ld_quiz_last_attempt quiz_id="x" user_id="y"
Display the date and time 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:
- user_id (current user id by default): ID of the user
- course_id: ID of the course. Optional
- type: ‘percentage’ or ‘score’. Percentage by default
[ea_ld_quiz_last_score user_id='x' quiz_id='y' course_id='z' type='percentage']
Display the last score (points or percentage) of the last attempted quiz by a user:
- user_id: ID of the user. Default to currently logged-in user
- course_id: ID of the course
- quiz_id: ID of a particular quiz to find the last score of attempts of that quiz. Optional
- type: ‘percentage’ or ‘score’. Percentage by default.