If you’ve been using WordPress for quite some time now, you might have come across the term “shortcode”. The term itself isn’t explanatory, not at first. Shortcode can be explained as WordPress–specific code written in brackets like
[this] that performs complicated functions in minimum efforts. So basically Shortcode implies shortcut. WordPress provides a vast range of shortcodes to make your life easier. Since WordPress is an open-source platform you can customize these shortcodes in the way that suits you the best. The basic idea behind shortcodes were to help people embed things on their website without needing to know the details about the underlying code.
As mentioned earlier all shortcode are represented in brackets like,
[this], with the particular name of the shortcode inside. Any shortcode can be customized by simply adding the parameters that you want to set to it.
Here is an example of parameter-free shortcode that is used to display LearnDash profile information:
Here is how a shortcode will look after adding some parameter to get the results you desire. The parameter customizes user’s courses in ascending order by course title.
[ld_profile orderby=”title” order=”ASC”]
The LearnDash provides a variety of shortcodes which can also be used to put a conditional statement. If a certain thing is true the output contents within the shortcode will be displayed. Here is an example of a message being displayed to the students enrolled in the course.
[student]Only a student enrolled in this course can see this message.[/student]
This type of version has both opening and closing shortcode, with the forward slash (/) in the
Shortcodes in LearnDash LMS can be found under
Dashboard >> LearnDash LMS >> Course >> Course Shortcodes
LearnDash LMS provides you with a wide range of shortcodes to add information to your site without explicitly dealing with the code itself. You can add shortcodes in LearnDash LMS course, lesson, topic or quiz. However, if you’re already on the edit screen of your post you can simply click on the screen icon and place LearnDash LMS shortcode of your choice, hassle-free.
Here’s a list of all LearnDash shortcodes that can come in handy and would make your life much easier
|[ld_profile]||This shortcode is used to display the basic user|
information, including their name, avatar, total courses,
course points, certificates, quiz result and list of the
|[ld_user_course_points]||As the name implies, this shortcode displays all the course|
points of a user, irrespective of the page you’re at.
|[learndash_course_progress]||This shortcode is used to display the progress bar of a particular|
for the respective course.
|[ld_course_list]||It displays the list of all the courses. Many options for|
customization are available. When Course Grid add-on is
enabled, it will display courses in grid layout, thus simplifying it.
|[ld_lesson_list]||This works in the same manner as [ld_course_list] but displays|
the list of all the lessons. Also can be displayed through Course
|[ld_topic_list]||This shortcode works similar to [ld_course_list] but displays|
topics of a particular course and also supports Course Grid add-
|[ld_quiz_list]||Displays the list of quizzes for the course with complete support|
of 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 the lesson or topic page.|
However, you must be using video progression in order for this
shortcode to work.
|[learndash_payment_buttons]||Shows the payment button for courses, anywhere on the page.|
|[ld_course_info]||This shortcode is used to display the list of enrolled courses,|
course progress, course details and quizzes taken by the user.
|[learndash_login]||The shortcode displays the LearnDash login and registration|
pop-up when clicked.
|[visitor]||Displays content for a user that is not enrolled in a course.|
Content should be enclosed between the opening and ending tag
|[student]||Displays content for a user registered in a course. Can also be|
customized to display content for individual users (based on the
user id). Content should be enclosed between the opening and ending tag
|[course_notstarted]||This shortcode displays course content for user that has enrolled in|
the course but has not completed any steps. Content should be enclosed
between the opening and ending tag
|[course_inprogress]||Displays content for the users who have access to a course and also|
has completed one or more steps but hasn’t completed the entire
course content. Content should be enclosed between the opening
and ending tag
|[course_complete]||Displays content if and only if a student has completed the whole|
course. Content should be enclosed between the opening and ending tag
Want to learn more about how each shortcode works? check out the LearnDash article on shortcodes and blocks