Build Your Own Business Website header image

How to Build a Free Membership Site – Part 9 – Show Teaser Content to Visitors

Difficulty Level -

Filed Under Topics - ,

Listed Under Lesson Subjects -

Applies to -

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

Instead of adding a custom message for the private page under Content Protection we could actually put teaser content here. In that case, instead of protecting the whole page what you can do is use the shortcode from our Members Plugin that protects this.

Members Plugin Shortcodes

In fact, in order to understand the shortcodes, if you go to the settings of the plugin and come up to the Help you’ll see there is this documentation link. If you click on that documentation you get to this document that tells you everything about the plugin really.

It’s got some nice philosophical information about roles and capabilities and that kind of thing but the thing you can do here is set access either based on the user role or if you’ve really only got one user role then you could also use this shortcode. Although what you really want is the ability to have a message.

Use Shortcode to Limit Visibility of Content

Let’s copy this code here, go back to our page in edit mode and then paste this inside of the text editor. We’ll add it down below the first few paragraphs. And we could say, access role=”distributor” and then take the closing shortcode tag and take it down to the bottom of the content.

Let’s update this. So now when you’re not logged in you can see part of the content that shows above where we inserted the shortcode.

What would be nice is if you could have a shortcode that would show content based on if the user’s not logged in but unfortunately that capability does not exist here and so there’s not really anything you can do about that. But let’s just look at Roles, the user roles that are setup.

So you can’t use that shortcode to create a message for the non-user. As luck would have it I have a fix for that in Thesis 2. This is not going to do any good for people who are using Genesis but I do have a fix for that for people who are using Thesis.

Interestingly, that code we added also hid it from the administrator so it only shows it to someone with the role of distributor. If you wanted to show it to the administrator as well you have to add that in there, administrator,distributor. Now when we update it the whole thing is available to the administrator.

So that’s the way I’m showing teaser content or part of the content without showing all of it.

Can You Use Shortcodes to Display Messages to Other Roles?

Megan asked, “Couldn’t you use the access shortcode to make a message that was visible to the other role like subscriber?”. Yes, you can. We could say role anonymous. Let’s see what happens if we set this access role. I don’t think it’s going to recognize anonymous. No, that didn’t work. So there isn’t a way with the plugin as it sits right now to have one piece of content that shows up for a logged in user and another piece of content that shows up for others.

Richard says, you could create anonymous user but that’s not useful because a user requires login. So you could create an anonymous user role but it nevertheless still has to have a login in order to have that user role assigned to it.

So what you’re looking for is something where the user is not logged in and you really don’t have that choice here. Although Thesis 2 and one of my boxes, Display Content by Role Box, gives you plenty of choices like that.

0 Comments… add one
0 comments… add one