Show or Hide Content


Warning: Undefined array key "for" in /var/www/uncanny-bqc5.1wp.site/wp-content/plugins/uncanny-learndash-toolkit/src/classes/show-hide-content.php on line 78

Warning: Undefined array key "for" in /var/www/uncanny-bqc5.1wp.site/wp-content/plugins/uncanny-learndash-toolkit/src/classes/show-hide-content.php on line 87

Overview

LearnDash includes some great shortcodes for showing content to learners that are enrolled in courses as well as users that aren’t enrolled—the and 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.

Live Demo

See this module in action on our LearnDash demo site!

Shortcodes

We include a 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:

Content for logged in users

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.

Content for logged out users

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.

8 thoughts on “Show or Hide Content”

  1. in courses i enable hide course (edit courses) but content is still showing non logged users why?

    content table is showing in given link why?

    1. Hi there, it looks like you were able to get the content table hidden. Regarding the content showing; that’s something you could ask LearnDash, as the setting is built into LearnDash and not related to our plugins. Thanks!

  2. Hello.

    I need at less 2 user catgories: Students 1 and students2.
    May be I can get this done with: Cimy User Extra Fields.

    Then both will take the same curse, but for students 2 I will need the are able to see more lessons.
    In other words, I need hide some lessons to students 1

    Can I use this little script or similar?

    thanks

    1. This should not be done, I’m afraid. You can’t make lessons optional in LearnDash, and if you did hide the lessons then users that didn’t see the lessons could never complete the course and progress wouldn’t be tracked properly. It won’t work; you should use a second course if some users see different lessons.

  3. Is it possible to restrict a whole page depending on a user’s login status? I can already hide menu items based on a user’s logged in status, but is there a way to restrict logged out users from even getting to a page, even if they had the URL? The best solution would be to redirect them to a different page where I can prompt them to log in or get in touch.

    1. It’s not possible with this module, but there are ways of achieving this with other plugins. Many membership plugins allow restrictions on entire pages.

Leave a Reply

Your email address will not be published. Required fields are marked *


Warning: Undefined array key "for" in /var/www/uncanny-bqc5.1wp.site/wp-content/plugins/uncanny-learndash-toolkit/src/classes/show-hide-content.php on line 78

Warning: Undefined array key "for" in /var/www/uncanny-bqc5.1wp.site/wp-content/plugins/uncanny-learndash-toolkit/src/classes/show-hide-content.php on line 87
Scroll to Top