View Product Page

Login Form shortcode

The shortcode Login Form allows you to add the WooCommerce login form to the page, which will be visible to all unlogged users.

Just type this in any page where you want it to appear:

[loginform]

Protect Media shortcode

The shortcode “Protected media” prints the protected media link. Please note: media should be set as protected before printing the link.
Shortcode attributes are:

  • “id”: ID of the protected media
  • “content”: Linked text

Example: [protected_media id=123]content[/protected_media]

Membership Items shortcode

The shortcode “Membership Level Items” allows you to show a complete list of all elements associated to a specific membership plan. This list is visible only to users who have subscribed to that plan. Go to “Membership > Membership Plans” to copy the shortcode related to the plan you want to show.

Membership item shortcode

You can use the attribute “plan” to set the ID of the membership plan.

“Example:” [membership_items plan=237]

membership items shortcode

Product Download Links shortcode

The shortcode Product Download Links prints product download links.
Shortcode attributes are:

  • id: product ID. If not specified, it prints the current product download links
  • class: the CSS class of download links
  • content: linked text. If it is not set, the linked text will be the name of the file set in the product
  • layout: set as box to print download links in a box.

Example: [membership_download_product_links id=111 class=”button button-test”]DOWNLOAD[/membership_download_product_links]

Membership History shortcode

The “Membership history” shortcode lets you show users the list of all memberships they are following.
The attributes of the shortcode are:

  • title: title you want to show ahead of the content of the shortcode
  • type: this attribute lets you filter the list of the membership displayed when you are also using the YITH WooCommerce Subscription plugin.
    type = “membership” this lets you show all memberships with no subscription plan of the users.
    type = “subscription” this lets you show all memberships with a subscription plan of the users.

An example of a shortcode: [membership_history id=”123″ title=”Shortcode Title” type=”membership”]

Please, note, to make sure all contents are visible here, you must have enabled it from Membership plans > [Your plan] > Show contents in membership details:

Show contents in membership details

Membership Protected Files shortcode

This shortcode allows you to handle displaying links within a specific page, post or product in your website.
Its goal is to display the files only to users who own a specific membership plan.
Enable the Membership Protected Files from the Membership options metabox in the edit page of any post, page or product of your website.
Paste a link or load a file right from this page and choose the membership plan it will be visible to.

Protected files

Now you can enter the[membership_protected_links] shortcode within the content and users will be automatically displayed the links related to the membership plan they own.

Protected files

 

Shortcode attributes

  • post_id: the ID of the post, the page or the product that contains the protected links. If not set, it uses global post ID
  • link_class: The CSS class of download links

Membership Protected Content shortcode

The “Membership Protected Content” shortcode can be selected from within posts, pages and products.

It allows you to set up different content for the same “post” (page or product) of each different membership plan: the system will automatically select the content to display to each customer, according to the type of membership they own.

Every content added within the shortcode will only be displayed to customers who own a membership plan.

Please, consider this shortcode has two different forms: an opening and a closing one. The restricted content has to be placed within the opening and closing shortcode.

Opening shortcode (setting the start of the restricted content):

[membership_protected_content]

Content to restrict in between

Closing shortcode (setting the end of the restricted content): [/membership_protected_content]

In the opening shortcode, you will be able to specify more details through the available attributes:

  • plan_id="": to restrict the content visibility to the members of one or more plans, you can add the plan ID attribute in the opening tag of the shortcode. To find the plan ID, go to "Memberships":
Membership plan ID
  • user="": this attribute defines the type of user that can view the content, and so change the way the restricted content works. By default, it is set to member, but all available options are: member, non-member, guest, logged.

Examples

Selective content - examples

Example 1:

[membership_protected_content plan_id="123"] This content is only visible to members of plan 123 [/membership_protected_content]

Selective content

Example 2

Suppose you want to show the content to all non-members except for those who have the plan with id="123", you may want to compose the shortcode as follows:

[membership_protected_content plan_id="123" user="non-member"] All users except for those with the 123 plan will see this content. [/membership_protected_content]

Selective content - example 2

Example 3 - Gutenberg blocks

You can also restrict access to one or more Gutenberg blocks, for example, if you have a video block.

In this case, you'll have to compose your blocks as follows:

  • one block to add the opening shortcode
  • one block with the content to restrict (for example the video block)
  • one block to add the closing shortcode

As you can see in the screenshot below:

Gutenberg blocks and shortcode

Members-only content starts here

The plugin gives you the possibility to insert a divider line in your posts so you can hide the content of the post partially, namely everything that is AFTER the divider.

This way members will see the whole content, whereas non-members will only see the first part.

You can find it both as a Elementor widget and as a simple shortcode. You can also find it as an Gutenberg block, you can refer to this page for more information.

Elementor widget

Click on the “add block” button and you will find the widget in the YITH section.

Members only elementor widget

After the divider, the plugin will automatically show the default alternative content (if set).

Continue reading?
Please, note that this widget and the related shortcode only works if you have chosen to show an alternative content for non-members from the General options, as explained here.

Yet if you want to hide the alternative content, you can enable the “Hide alternative content” option (if necessary) from the page builder editor:

Hide alternative content - elementor
Elementor

Shortcode

You can also use it as a simple shortcode:

[yith_wcmbs_members_only_content_start]

Members-only-content shortcode classic

And if you want to hide the alternative content, you can use the attribute hide-alternative-content and set it to ‘yes’, like this:

[yith_wcmbs_members_only_content_start hide-alternative-content='yes']