730wavy
730wavy

Reputation: 704

How to put php code inside opening and closing shortcodes

I am working on a site and I am using a shortcode in my template files that has an opening and close. I would like to know if its possible to place wordpress the_content php tag in between the shortcode and if it's possible to the same thing with placing another shortcode in between opening and closing tags.

I've tried this -

<?php echo do_shortcode('[membership level="1"]''.$the_content.''[/membership]'); ?>

But it's not working, I tried a few others things as well. What am I missing or doing wrong? Any help is much appreciated. Thanks.

Upvotes: 1

Views: 3574

Answers (1)

jmadsen
jmadsen

Reputation: 3675

looks like you have extra single quotes?

try:

echo do_shortcode('[membership level="1"]'.$the_content.'[/membership]');

Upvotes: 5

Related Questions