0

Is it possible to nest multiple shortcodes with do_shortcode?

Using visual composer and easytable with the visual editor, the classic editor displays:

[vc_row][vc_column width="1/1"][vc_accordion][vc_accordion_tab title="Section 1"][easytable]table stuff[/easytable][/vc_accordion_tab][vc_accordion_tab title="Section 2"][/vc_accordion_tab][/vc_accordion][/vc_column][/vc_row]

I have attempted something like this:

echo do_shortcode( '[vc_row][vc_column width="1/1"][vc_accordion][vc_accordion_tab title="Section 1"][vc_column_text] [table]
' .$sometabledata. ' is some data
[/table][/vc_column_text][/vc_accordion_tab][vc_accordion_tab title="Section 2"][/vc_accordion_tab][/vc_accordion][/vc_column][/vc_row]' );

However, this seems to generate the accordion, but the table is then lost. Separately the table works with:

echo do_shortcode( '[table]mydata[/table]' );
3

Okay, you need this:

<?php echo do_shortcode('[your-first-shortcode]'.'[your-second-shortcode]'); ?>

Just write a dot between your shortcodes...

Try:

<?php echo do_shortcode( '[vc_row][vc_column width="1/1"][vc_accordion][vc_accordion_tab title="Section 1"][vc_column_text]'.'[table]'.$sometabledata.'[/table]'.'[/vc_column_text][/vc_accordion_tab][vc_accordion_tab title="Section 2"][/vc_accordion_tab][/vc_accordion][/vc_column][/vc_row]' ); ?>
  • Great. I'm glad I helped. – Medardaosa Sep 29 '14 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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