How to parse nested shortcodes in wordpress?

Hi, 


From the WordPress documentation, I understand that it is a WordPress shortcodes limitation. Is it still possible to get it work?
The nested shortcodes won't parse correctly:

[row]
    [col size="6"]...[/col]
    [col size="6"]
        [row]
            [col size="6"]...[/col]
            [col size="6"]...[/col]
        [/row]
    [/col]
[/row]


Here's my shortcodes code, it works fine if its not nested (ie., row shortcode is not used inside the col shortcode).

add_shortcode( 'row', 'row_cb' );
function row_cb( $atts, $content = null ) {
$output
= '';
$output
.= '<div class="row">';
$output
.= do_shortcode( $content );
$output
.= '</div>';

return $output;
}

add_shortcode
( 'col', 'col_cb' );
function col_cb( $atts, $content = null ) {
extract
( shortcode_atts( array(
'size' => '',
), $atts ) );


$output
= '';
$output
.= '<div class="col">';
$output
.= do_shortcode( $content );
$output
.= '</div>';

return $output;
}

Asked 25 Nov, 16 at 03:25 AM

Arun Sharma
Php Wordpress

Answer

Not answersed yet.