On your membership site, you can create membership levels so that members can only access the pages they’re entitled to view based on their level. If you’d like to go a step further and show certain content within a page to certain membership levels, you can do so using shortcodes.

Shortcodes allow you to easily dictate what information should show on a membership site page without complicated lines of code. You can use shortcodes to show or hide content based on the user’s membership level, tag, or whether the user is recognized by Ontraport. See our shortcode reference page for specific shortcodes for accomplishing different goals. Then follow the steps below to insert the shortcodes and test them.

How To Insert Shortcodes

Once you know which shortcodes you’d like to use, you can insert them onto your membership site.

If you created your membership site pages in Ontraport Pages and added them to your WordPress site via the Ontraport Pages plugin, you’ll manually add your shortcodes before and after the content you wish to show/hide in the Ontraport Pages editor.

How to Add Shortcodes to an Ontraport Page

In Ontraport Pages, you can add shortcodes to surround individual blocks you’d like to show to certain members, or within blocks to protect partial sections. In this example, we provide steps for the first option.

  1. Add blocks above and below the content you’d like to show. Alternatively, you can add a row or even just a text element before and after.
  2. Insert text elements in the blocks
  3. Place the Shortcode above and below the area in which you would like to protect. In this example the top Shortcode is [show_if has_one=’Gold’] and the bottom Shortcode is: [/show_if].
  4. In WordPress:
    • Log in as an administrator and ensure the Ontraport Pages for WordPress plugin is installed.
    • Go to Ontraport Pages > Add New.
    • Title the page and use the dropdown to select the Ontraport Page you created.
  5. Now the content “Ready to Talk…” will only be seen by those that are Gold members.

How To Add Shortcodes in the WordPress Page Editor

In the WordPress editor, you will insert the merge fields and add the code information per the guidance above based on which type of criteria you’re using to show/hide content.

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.