How would you do a shortcode wrapper that can differentiate between different nested shortcodes.

[teaching_tool_wrapper param1="true" param2="false"]
    [chord param1="something"]
    [scale param1="something-else"]

I have it working fine with just the [chord] shortcode, however i'm not sure how to get the wrapper differentiating between the two different types of nested shortcodes.

2 Answers 2


Can be useful do_shortcode function?



I've figured out a solution. do_shortcode will do all the shortcode contents in the wrapper, however I wanted the nested shotcodes processed in different places.

    // make sure only the [chord] shortcodes are inserted here.
    $custom_chords = rtrim($custom_chords, "]");
    $custom_chords_array = explode(']', strip_tags($custom_chords));
    foreach($custom_chords_array as $custom_chord){
        if(strpos($custom_chord, '[chord') != false){
            echo do_shortcode($custom_chord .']');

Seems to work!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.