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]

From the WordPress documentation, I understand that it is a WordPress shortcodes limitation. Is it still possible to get it work?

Edit:
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; 
}

3 Answers
3

There’s a solution for that, actually. The shortcode you are using has the variable $content, whithout the filter do_shortcode, like this:

do_shortcode($content)

Open the file where there are the shortcodes and change $content for do_shortcode($content). It will work.

Leave a Reply

Your email address will not be published. Required fields are marked *