LearnDash includes some great shortcodes for showing content to learners that are enrolled in courses as well as users that aren’t enrolled—the [visitor] and [student] shortcodes. These are great on course pages, but what about inside Open courses and elsewhere on a LearnDash site? Sometimes you may want to show content based on the user’s signed-in state rather than whether or not they’re enrolled in a course. We use this a lot when we want to hide content from anonymous visitors (while still giving them a taste of what’s available) and encourage users to create an account to view free course materials.
We include a [uo_show] shortcode in the Toolkit that make it easy to show content based on signed-in state. Here are some examples of how to use the shortcode:
[uo_show for='loggedin']Content for logged in users[/uo_show]
That example displays the text to users that are signed in. This might be useful in an Open course to display special bonus content, like a video or download.
[uo_show for='loggedout']Content for logged out users[/uo_show]
That example displays the content for users that aren’t signed in. This is helpful for calls to actions and other marketing that isn’t relevant to signed-in users.