If you want to protect/hide a section (or sections) of a post/page then you can do that using the Simple Membership Partial Protection addon.
This can be useful to create teaser content where the visitors can see part of a page content for free and the rest of the page is protected.
The following screenshot shows an example of how a partially protected post/page may look like:
Download the Partial Protection Addon
Download the free Simple Membership Partial Protection addon.
Install the Addon
- Click on the Add New menu under the plugins interface.
- Go to the Uploader tab and upload the swpm-partial-protection.zip file.
- Hit the Install Now button and then activate the addon.
Using the Partial Protection Addon
This addon comes with a shortcode that you can use to wrap the content that you want to protect or hide.
Go through the following shortcode examples. It will show you how you can use this partial/section protection shortcode.
Simple Partial Protection Example
[swpm_protected] Whatever content goes here is only visible to logged-in members who have access to this post or page. [/swpm_protected]
Partial Protection for Specific Membership Level(s)
[swpm_protected for="2-3-4"] Whatever content goes here is only visible to members who belong to the specific membership level(s) specified in the shortcode. [/swpm_protected]
Where 2,3,4 are the membership level IDs that you want to allow access to this section of content.
Partial Protection with Protected Message Formatted Nicely
The content protection message is shown in plain text without any styling by default. This is so you can define your own custom CSS styling if you wanted to.
You can specify the format_protected_msg=1 parameter in the shortcode to tell the addon to output a nicely formatted protection message. This parameter can be used in any of the shortcodes explained in this page.
Below is an example:
[swpm_protected for="2" format_protected_msg="1"] Whatever content goes here is only visible to members who belong to the membership level 2. [/swpm_protected]
It will produce a formatted protection message like the one shown below:
Partial Protection for a Specific Member
[swpm_protected member_id="1"] Whatever content goes here is only visible to the member whose Member ID is 1. [/swpm_protected]
Partial Protection for Anyone Who is Logged-in
If you want to just protect a section of a post or page for logged-in members (it doesn’t matter if the member’s account status is expired or not) then use the following shortcode:
[swpm_protected visible_to="logged_in_users_only"] Whatever content goes here is only visible to anyone who is logged-into the SWPM system as a user (doesn't matter if his account is expired or not). [/swpm_protected]
Section Protection for Anyone Who is NOT Logged-in
If you want to just protect a section of a post or page for non logged members (only anonymous visitors will see this section) then use the following shortcode (can be useful if you only want to show a message to the anonymous users):
[swpm_protected visible_to="not_logged_in_users_only"] Whatever content goes here is only visible to a non logged user (anonymous visitors of your site will see this message). [/swpm_protected]
Partial Protection for Expired Members Only
If you want to protect a section of a page for expired members (only expired members will see the content) then use the following shortcode:
[swpm_protected visible_to="expired"] Only the expired members will be able to see this message. [/swpm_protected]
If you want to protect a section of a page for expired members of a particular level then use the following shortcode:
[swpm_protected visible_to="expired" for="2"] Only the expired members from membership level 2 will be able to see this message. [/swpm_protected]
Partial Protection Not For Specific Membership Level
If you want to protect a section and make it NOT visible to a particular membership level then use the following shortcode:
[swpm_protected not_for="2"] Whatever content goes here is NOT visible to members of membership level 2. All the other members can see this content. [/swpm_protected]
Partial Protection without the “Content is protected” Message
If you want to protect a section of a page without showing the “Content is protected” message to the non logged-in users then use the following shortcode (this is useful if you don’t even want them to know that there is a section of content there):
[swpm_protected for="2-3" do_not_show_protected_msg="1"] Whatever content goes here is only visible to members who belong to the specific membership level specified in the shortcode. Also, the users who do not have access to this content won't see a "Content is protected" message. [/swpm_protected]
Partial Protection without the Protected or Renewal Message
The following section protection option protects the section without showing the “Content is protected” or “Renew your account” message (this is useful if you don’t even want them to know that there is a section of content there):
[swpm_protected for="2-3" do_not_show_protected_msg="1" do_not_show_expired_msg="1"] Whatever content goes here is only visible to members who belong to the specified membership level. Users who do not have access to this content won't see a "Content is protected" message. The expired members won't see the renewal message either. [/swpm_protected]
Using a Custom Message for the Non Members
This section protection shortcode can take another extra optional argument which can help you customize the text/message that is shown to non members. Here is an example:
[swpm_protected for="2-3" custom_msg="This is a custom protection message"] The content goes here. this content will be hidden and only available to members of membership level 2 or 3. [/swpm_protected]
Partial Protection Custom Message with HTML Link
You can use a HTML link in the custom message that you specify for the section protection shortcode. Remember to switch to the “Text” mode in the WordPress post/page editor if you are typing in HTML link code. Here is an example:
[swpm_protected for="2-3" custom_msg='This is a <a href="http://www.example.com">test link</a> in the message'] The content goes here. this content will be hidden and only available to members of membership level 2 or 3. [/swpm_protected]
Important Note
When you want to use partial protection on a post or page, you should not protect the full post or the category that the post belongs to. When you apply category protection for a category, all the posts in that category is fully protected (category protection overrides any other protection in the post).