Conditional Shortcodes

This Article Applies to

Conditional shortcodes perform a test and then display (or don’t display) the content within the shortcode depending on the result of the test. Conditional shortcodes are often nestable so that you can perform multiple tests. All tests are binary meaning they resolve to a simple true-false / sucess-fail / yes-no condition.

Conditional shortcodes usually start with a word like is or has, asserting a condition.

Conditional shortcodes can be used three different ways:

Single shortcode – displays “Yes” if the shortcode test passes, displays “No” on test failure.

As of Version 2.43, you can use [else_memb_shortcodename] or [else_shortcodename] interchangeably.

Example:

[memb_is_logged_in]

Shortcode with content – wraps a single block of content in the conditional tag. The content in the shortcode is displayed if the test passes, and not displayed if the test fails.

Example:

[memb_is_logged_in] You are Logged In [/memb_is_logged_in]

Shortcode with alternate content – wraps TWO blocks of content separated by an [else_] shortcode. The first block is displayed if the test passes, the second block is displayed if the test fails.

Example:

[memb_is_logged_in]
You are Logged in
[else_memb_is_logged_in]
You are not logged in
[/memb_is_logged_in]
9 ways to add more value to your membership site

Table of Contents

This Article Applies to

Related Posts

Ready to See How You Can Automate Your Course or Membership With Memberium for ActiveCampaign?

Watch this quick demo video to see how Memberium works. Discover how thousands of successful business owners use Memberium to sell their membership programs and how you can too! If you’re ready to get started, you can check out our plans and pricing here…