How to put php code inside opening and closing shortcodes

假装没事ソ 提交于 2019-12-23 05:21:14

问题


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.


回答1:


looks like you have extra single quotes?

try:

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


来源:https://stackoverflow.com/questions/15514401/how-to-put-php-code-inside-opening-and-closing-shortcodes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!