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.
Want to learn more about how each shortcode works? check out the LearnDash article on shortcodes and blocks