When adding content on your WordPress site, you can control which membership levels can see specific content on the same page by using shortcodes. Below, we have included examples of each shortcode available for showing and hiding content on your WordPress site. After you determine your shortcodes, follow these steps to insert the shortcodes on your membership site pages.
WordPress membership sites are available to Plus levels and above.
 

About Shortcodes

First, here are the shortcodes available:

You can use these in a variety of ways to show and hide certain content based on:

  • Membership Level
  • Tags
  • Ontraport Contact Status
  • Cookie

Show/Hide Content Based on Membership Level


In the following examples we are using the membership levels Bronze, Silver and Gold. The membership level we have added to the shortcode is shown in blue.

+ Has onekeyboard_arrow_downkeyboard_arrow_up


This shortcode will display the content if the member has
any of the membership levels. If the member has a single membership level listed in the shortcode, then they are able to view your content.

What the editor inserts: [show_if has_one=””]content[/show_if]

Edited to show to Bronze members only: [show_if has_one=”Bronze”]content[/show_if]

Edited to show to Bronze or Silver members but not Gold: [show_if has_one=”Bronze, Silver”]content[/show_if]keyboard_arrow_downkeyboard_arrow_up

+ Has allkeyboard_arrow_downkeyboard_arrow_up

 

This shortcode limits the display to only those members who have all of the included membership levels. For content to show, the member must have every level listed in the shortcode — if they only have one, then the content will not be visible to them.

 

What the editor inserts: [show_if has_all=””]content[/show_if]

Edited to show to Bronze members only: [show_if has_all=”Bronze”]content[/show_if]

Edited to show to members with BOTH Bronze and Silver memberships: [show_if has_all=”Bronze, Silver”]content[/show_if]

A member with only Bronze membership will NOT see the content, as they must have BOTH Bronze and Silverkeyboard_arrow_downkeyboard_arrow_up

+ Does not have onekeyboard_arrow_downkeyboard_arrow_up

 

For the content to show, the member must not have any of the membership levels listed. Contacts with one of the listed membership levels will not be able to view the content.

 

What the editor inserts: [show_if not_one=””]content[/show_if]

Edited to show to members WITHOUT Bronze membership: [show_if not_one=”Bronze”]content[/show_if]

The content is shown to members without the Bronze level.

Edited to show only to members WITHOUT Bronze or Silver: [show_if not_one=”Bronze,Silver”]content[/show_if]

The content is not shown to members with either Bronze or Silver memberships.keyboard_arrow_downkeyboard_arrow_up

+ Does not have anykeyboard_arrow_downkeyboard_arrow_up


The content inside the shortcode will be shown if the member
doesn’t have all of the membership levels listed. When multiple membership levels are placed within this shortcode, the content isn’t visible to contacts who have every level listed. If the shortcode contains multiple levels, and the contact only has one of them, then the content will be visible to them.

 

What the editor inserts: [show_if not_any=””]content[/show_if]

Edited to show to everyone without Bronze membership: [show_if not_any=”Bronze”]content[/show_if]

Edited to exclude anyone with BOTH Bronze and Silver membership: [show_if not_any=”’Bronze,Silver”]content[/show_if]

If the member does not have either level or only has Bronze or Silver, then the content will still be visible.keyboard_arrow_downkeyboard_arrow_up

 

Show/Hide Content Based on Tags


The member must be logged in for these shortcodes to display or hide content.

+ Has tag(s)keyboard_arrow_downkeyboard_arrow_up

 

If the contact has the tags listed, they will be able to see your selected content.

What the editor inserts: [show_if has_tag=””]content[/show_if]

Edited to show to logged in members with the Tag “Action”: [show_if has_tag=”Action”]content[/show_if]keyboard_arrow_downkeyboard_arrow_up

+ Does not have tagkeyboard_arrow_downkeyboard_arrow_up

 

If the contact has the tags listed, they will not be able to see the content.

What the editor inserts: [show_if does_not_have_tag=””]content[/show_if]

Edited to show content to logged in members who do NOT have the Tag “Action”: [show_if does_not_have_tag=”Action”]content[/show_if]keyboard_arrow_downkeyboard_arrow_up

 

Show/Hide Content Based on Ontraport Contact Status


The member must be logged in for these shortcodes to display or hide content. These shortcodes are used to display or hide content based on if the member is a contact in your Ontraport account. These do not require any editing of the shortcode that is entered into the editor.

+ Is a contactkeyboard_arrow_downkeyboard_arrow_up

 

If the WordPress user is a contact in your Ontraport account, then they will be able to see your selected content.

 

What the editor inserts: [show_if is_contact]content[/show_if]keyboard_arrow_downkeyboard_arrow_up

+ Is not a contactkeyboard_arrow_downkeyboard_arrow_up

 

If the WordPress user is not a contact in your Ontraport account, then they will be able to see your selected content.

What the editor inserts: [show_if not_contact]content[/show_if]keyboard_arrow_downkeyboard_arrow_up

 

Show/Hide Content Based on Cookie


These shortcodes work even if the member is not logged in. PilotPress checks for Ontraport’s cookie and shows or hides content based on the presence of that cookie. These do not require any editing of the shortcode that is entered into the editor.

+ Is a cookied contactkeyboard_arrow_downkeyboard_arrow_up

 

If the browser used to view your page has Ontraport’s cookie, then the content is visible to them.

What the editor inserts: [show_if is_cookied_contact]content[/show_if]keyboard_arrow_downkeyboard_arrow_up

+ Is not a cookied contactkeyboard_arrow_downkeyboard_arrow_up


If the browser used to view your page does not have an Ontraport cookie stored, then the content is visible to them.

 

What the editor inserts: [show_if not_cookied_contact]content[/show_if]keyboard_arrow_downkeyboard_arrow_up

 

Resync Contacts


This shortcode retrieves information from Ontraport when the page loads to resync the contact. It does not display or hide content. However if your contact has changed membership levels, it will allow your site to use the updated information about the contact’s membership level.

What the editor inserts: [pilotpress_sync_contact]

The resync shortcode has built-in looping protection to protect your site from multiple page refreshes. After the page initially loads, the shortcode sets a timer and will accept two page refreshes in a five-minute period. After the second page refresh, the shortcode will be inactive for five minutes. This prevents a loop condition from slowing down or crashing your membership site.

 

Testing Membership Shortcodes


When using the  “PilotPress Admin View As” feature, you can only test one membership level at a time. To test the shortcodes that require ALL of the membership levels to be present, for example  [show_if has_all=”Bronze,Silver”]content[/show_if], follow the process below.

  • Create a new contact for testing purposes. Add a membership level to the contact. Keep Ontraport open to this contact record.
  • Open a new private tab or window in your browser.
  • In the private tab or window, clear the cookies for your WordPress site.
  • Go to the default WordPress login page by adding “/wp-login.php” to your domain: http://your-domain.com/wp-login.php
  • Log in as your new contact. Test the functionality of your membership levels and shortcodes.
  • To test a new membership level, log the contact out of WordPress. Add the new membership level in Ontraport and log the contact back into WordPress.

 

Redirect Logins by Membership Level


In PilotPress settings, you can select which page your customers will go to after they log in. If you want to send your members to different pages based on their membership level, you can do it using a shortcode that contains a meta refresh tag. To accomplish this, follow the steps below.

Note, WordPress classic blocks will not work for this function. 

  • Go to the page you selected in your post-login redirect settings
  • Add an HTML block to your page. 
  • Add a “show_if has_one” membership shortcode described above.
  • Replace the content for the shortcode with <META http-equiv=”refresh” content=”0;URL=URL of the page you want to redirect to” />

For example, if you want to send your “Gold” members to http://your-domain.com/gold after they log in, your shortcode would look like this: 

[show_if has_one=”Gold”]

<META http-equiv=”refresh” content=”0;URL=http://your-domain.com/gold” /> 

[/show_if]