View Product Page

Visible content shortcode

You can use this shortcode to show custom content that has to be visible to the affiliates only. It works like an opening and closing tag set, so the text goes between the tags.

Example:

[yith_wcaf_show_if_affiliate] This content will only be visible to affiliates [/yith_wcaf_show_if_affiliate]

Or if you use blocks, you can add the opening shortcode in one block, then add a block with your content, and finally add another shortcode block with the closing shortcode.

If you are not an affiliate, you will not be able to see the content.

Attributes

The shortcode can also be used for more complex cases, thanks to the included attribute that allows you to show the content to specific affiliates only.

The attribute is show_to and the following are the accepted values:

  • valid_affiliates: shown only to valid affiliates, that is enabled affiliates and hidden to banned ones.
  • enabled_affiliates: shown only to enabled affiliates.
  • all_affiliatesshown to all affiliates.
  • {user role}if you enter a valid user role name, such as shop_manger, the content will be shown just to users with both the shop manager role.
  • logged_in_users: shown only to logged users.
  • anyone: all users.

You can also combine more than one conditions separated by commas and the content will be displayed if at least one of those is true.

Additionally, it is possible to deny one condition by applying a ! before the condition. This could be useful, for example, if you want to show the content to everyone but affiliates.

Example with attribute:

[yith_wcaf_show_if_affiliate show_to="enabled_affiliates"]
CONTENT FOR AFFILIATES ONLY
[/yith_wcaf_show_if_affiliate]

[yith_wcaf_show_if_affiliate show_to="all_affiliates"]
CONTENT FOR NON-AFFILIATES ONLY
[/yith_wcaf_show_if_affiliate]