Nestable Shortcodes

First_matryoshka_museum_doll_openWhen working with conditional shortcodes it’s often useful to have a series of tests, one after another, where each test determines if the user is qualified to continue to the next test.

Due to a limitation in WordPress’s design, the built-in shortcode system is very fast but it does not know how to count levels of nesting, so it cannot match each opening tag with its correct closing tag. In order to cleanly support this feature while not sacrificing performance, we provide the ability to nest shortcodes by giving each nested group of shortcodes a unique name by adding a number to the end. You can think of this like a Russian Matryoshka doll.

Some basic rules of nesting shortcodes:

Not all shortcodes can be nested. Only conditional shortcodes are ever made to be nested. There is no reason to nest a non-conditional shortcode.

Not all shortcodes can be nested the same number of times. A few simple shortcodes which perform very simple test can only be nested a few times since their tests are very limited.

There is a limited number of times that any given shortcode can be nested.

To nest a shortcode simply add a number to the end of the shortcode name. Similarly for [else_ and closing shortcode markup, you would add the matching number as well.

Some examples:

[memb_is_logged_in]
	[memb_is_logged_in1]
		[memb_is_logged_in2]
		[else_memb_is_logged_in2]
		[/memb_is_logged_in2]
	[else_memb_is_logged_in1]
	[/memb_is_logged_in1]
[else_memb_is_logged_in]
[/memb_is_logged_in]
  • Was this Helpful?
  • YesNo
9 ways to add more value to your membership site

Table of Contents

Keep Reading

confirmation link memberium

Guide to Using Confirmation Link in Memberium

You must have seen confirmation links in emails, and its like a compulsory step to proceed forward when creating an account on the site. In this small guide, you’ll learn the benefits of using confirmation link and how you can use them in your campaign. Let’s get started!

Read More »

Make Password

Use an HTTP post to generate a password and save it to the contact’s Infusionsoft record. Optionally create a local user in the WordPress database. If the user already exists in the WordPress database, no action will be taken.

Read More »

Want to get some fresh ideas on how you can improve your membership site or course?

Download our free ebook!

Book a Call

Welcome to Memberium!

We are very excited for you to be part of our family. 

We would love to answer any questions that you have!

Please choose the best time for you to get in a call with us. 

For Technical Support, you can contact us at https://memberium.com/support/ or Email us at support@memberium.com.