Nesting Same Shortcode WordPress

I wonder if below is a valid scenario.

[column class='container-fluid']
[column class='container']
[column class='row-fluid']
[column class='span4'] One [/column]
[column class='span4'] Two [/column]
[column class='span4'] Three [/column]
[/column]
[/column]
[/column]

Code for shortcode is as below.

Read More
function get_column($atts,$content = NULL){
    extract( shortcode_atts( array(
        'class' => '',
    ), $atts) );
    return '<div class="'.strip_tags($class).'">'.do_shortcode($content).'</div>';
    }
add_shortcode('column','get_column');

Expected Output should be:

<div class='container-fluid petturn1'>
<div class='container'>
<div class='row-fluid'>
<div class='span4'> One </div>
<div class='span4'> Two </div>
<div class='span4'> Three </div>
</div>
</div>
</div>

and Actual output is :

<div class="container-fluid petturn1">
<div class="container"></div>
<div class="row-fluid"></div>
<div class="span4"></div>
One
</div>
<div class="span4"> Two </div>
<div class="span4"> Three </div>
[/column][/column][/column]

I am not sure if we can do such level nesting of same shortcode in WordPress.Can any one please find it what is wrong with above code.

Does WordPress allows nesting same shortcode?

Thanks.

Related posts

Leave a Reply

1 comment

  1. Limitations: Nested Shortcodes

    The shortcode parser correctly deals with nested shortcode macros, provided their handler functions support it by recursively calling do_shortcode():

    [tag-a]
       [tab-b]
          [tag-c]
       [/tag-b]
    [/tag-a]
    

    However the parser will fail if a shortcode macro is used to enclose another macro of the same name:

    [tag-a]
       [tag-a]
       [/tag-a]
    [/tag-a]
    

    See the documentation.