WordPress already has built in support for Nested Shortcodesprovided their handler functions support it by recursively calling.
So if you have for example:
[tag-a]
[tag-b]
[tag-c]
[/tag-b]
[/tag-a]
As long as you recursively call do_shortcode in your shortcode function, all the shortcodes would be parsed.
So you would define the functions for your shortcodes as such:
For tag-a:
function tag_a( $atts ){
$output = "";
return do_shortcode($output);
}
add_shortcode( 'tag-a', 'tag_a' );
For tag-b:
function tag_b( $atts ){
$output = "";
return do_shortcode($output);
}
add_shortcode( 'tag-b', 'tag_b' );
For tag-c:
function tag_c( $atts ){
$output = "";
return do_shortcode($output);
}
add_shortcode( 'tag-c', 'tag_c' );
Related Posts:
- Return HTML Template Page with PHP Function
- How do I use Shortcodes inside of HTML tags?
- Is there a way to parse shortcodes in PHP?
- Display sorting options dropdown when using WooCommerce product category shortcode
- Retrieve multiple values passed to a single attribute in a shortcode
- WordPress Shortcode and Dynamic CSS
- ob_get_clean returns empty string, ob_get_flush outputs string
- Shortcode created to check language not works
- Creating a WordPress shortcode
- How do I hardcode a WordPress shortcode into my theme?
- has_shortcode() – how to detect nested shortcode
- How to return multiples lines in a shortcode?
- PHP contact form returns warning in text widget [closed]
- Recent post display using shortcode
- How do I turn a shortcode into PHP code?
- How to return a foreach inside a shortcode
- Placing raw HTML inside a WordPress shortcode
- custom shortcode will not display the wrapped content
- Shortcode content output but not in correct place
- PHP code inside shortcodes
- Trigger popup in a php if/else statement
- How to output a PHP file values by shortcode?
- How to display posts by current user in a drop down
- Colon is Missing In My Website Url in WordPress
- Pass php dynamic variable to shortcode
- wordpress 4.4 self hosted video (html5) doesn’t show
- do_shortcode with custom field
- Remove echo from shortcode
- Shortcode to show the code
- Get URL from shortcode tag
- Only first shortcode gets executed
- Multiple do_shortcode in page template
- echo something inside a shortcode
- Shortcode from a function not working
- Is it possible to return content, and then also continue to do other things?
- anyway to put inside a $outprint=sprintf()
- $wpdb returns duplicate posts
- Creating WordPress Shortcode with Variable
- Catchable fatal error: Object of class stdClass could not be converted to string
- Shortcode to find and replace URL
- Could use some help with Shortcodes
- How to put a form with php code into a variable or shortcode?
- Shortcode to embed Edit Account form not working
- Line breaks inside shortcode variable
- Handling PHP/HTML inside the output of a shortcode function
- Shortcode for Listing Users from Meta Value?
- Need to Modify a WordPress Shortcode with another wordpress shortcode
- Shortcode to log user into current URL
- Shortcodes showing in excerpt despite using strip_shortcodes
- Calling PHP Titles inside Javascript Markup
- Create special button on WP Tiny MCE Posts Editor for Shortcodes
- How to get my [shortcode] rendered on the home page, other pages are fine
- Including Custom fields within the_content
- What is the difference between Null vs Empty (Zero Length) string?
- MySQL Query Returns Array () In Shortcode
- Show Featured Image Dimensions and size frontend with shortcode
- How to work Woocommerce pagination inside shortcode?
- How to get woocommerce orders with get_posts method in a shortcode
- Counting number of posts in multiple (sub)categories using shortcode
- Display Visual Composer shortcode if a post belongs in specific categories
- is it possible for a URL to filter by tag
- Trying to create a shortcode to display categories with a specific product tag
- How to pass parameters in wordpress shortcode?
- Replace background image with post thumbnail in shortcode
- How can I prevent a shortcode div from extending beyond its boundaries?
- Adding variable in WordPress shortcode
- Display a custom name when the user has no name settle in his account
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- Execute Shortcode in Textfile
- Echo short code syntax
- custom taxonomies not working
- How to return html as a string from php for WordPress
- Changing Date Format on Custom Meta Data w/shortcode call
- Display current user metadata on WordPress page
- Add Shortcode to ::before class
- Reload page with a different shortcode when a user selects from a dropdown
- Add the shortcodes from the enfold theme to the other theme
- How to output values from a loop into a javascript array
- Offset with ajax load more posts duplicates
- Short code into PHP
- How can i iterate through this shortcode array?
- Update same content in multiple posts at once?
- Shortcode in a $output statement
- Need help with PHP functions
- When using shortcode, content stops generating after the_content
- PHP Shortcode – 500 error
- Run PHP Results inside WP Shortcode
- Shortcode At top of Page – PHP 5.5 vs 5.4 – ob_start();
- Create dynamic content from one WP page to multiple other pages
- Shortcode Display From WordPress Dashboard Page Without Using post_id
- On selecting shortcode generate selected shortcode table inside page editor worrdpress
- Using the same shortcode to show any table from the database
- Shortcoding with Divs
- My title is showing after the shortcode
- Shortcode to include PHP file, pass various parameters to include?
- Is there a better way to output HTML as a shortcode?
- Gutenberg – render_callback does not pass ToggleControl value on frontend
- HTTP 500 Error after Creating Shortcode
- How call WordPress shortcode inside function file
- How to execute a shortcode within a custom field?