Enclosing the shortcode fixes many problems
-
Shortcodes come in three flavors:
- self-closing:
[strong]
- enclosing:
[strong][/strong]
- self-enclosing:
[strong ... /]
When using multiple
[strong]
‘s on a page and any of them wraps content or has child shortcodes, each one must be enclosed with[/strong]
. This seems to work better than the self-enclosing[strong ... /]
.If there is only one
[strong]
on the page, it would not require the extra closing[/strong]
.When in doubt, go with enclosed. See Enclosing Shortcodes to learn more.
For example, this will not work because the first shortcode is not enclosed:
[strong form] ... [strong per_page="3] [client] [field name="client_name" class="name"] [/client] [/strong]
But this will:
[strong form][/strong] ... [strong per_page="3] [client] [field name="client_name" class="name"] [/client] [/strong]
When counting
[strong]
‘s, consider the entire page, not only the main content field. Include any that are embedded in page builder components, text widgets, or template files. - self-closing:
- The topic ‘Enclosing the shortcode fixes many problems’ is closed to new replies.