Solutions keyboard_arrow_down keyboard_arrow_up
Our Solutions
Ontraport's solutions work together to give you everything you need to run your business in one centralized, easy-to-use platform.
Resources keyboard_arrow_down keyboard_arrow_up
Find free content on the latest marketing strategies, using Ontraport in your business, and finding the right software.
Visit the blog
University Pricing Chat
Use shortcodes to show or hide membership site content
Last updated on: April 10, 2023

This article is for those building a membership site using WordPress and PilotPress. If you're using Ontraport Membership Sites, click here. If you're getting started and don't know which to choose, this article will help.

On your membership site, you can create membership levels so that members can access only 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.

Add shortcodes in the WordPress page editor

If you have an integrated WordPress site, you can insert shortcodes directly into classic blocks for the pages and posts.

  1. Log in to your WordPress site as an administrator.
  2. Create or edit a page or post and add a classic block.
  3. Insert a shortcode by selecting it from the shortcodes dropdown.
  4. If your code references a membership level or tag, add your values in the space provided between the quotation marks.
    • If need to add multiple tags or levels, separate your values with commas.

To add shortcodes to an Ontraport page

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

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.
  1. Insert text elements into the blocks.

  1. Place your shortcode above and below the area you would like to protect.

  1. Add your page to your WordPress site with the Ontrapages plugin.
Related university lessons
Publishing on WordPress
Follow the steps for publishing Ontraport pages to your existing WordPress site using Ontrapages, a WordPress plugin.
Membership sites overview
Get a quick overview of how membership sites work in Ontraport so you can create your own site, deliver your content, and protect your gated pages.
Divider Text
Related support articles
WordPress integration troubleshooting
Connect your existing WordPress site
PilotPress and the WordPress editor
 Pro tips

To test your membership levels and shortcodes, the “PilotPress Admin View As” buttons become available after you save the post or page, and they allow you to view the page as a member with one membership level.

Live events
© Ontraport 2024
PCI DSS, Level 1
Privacy Shield Certified