如何在打开和关闭简码中放入php代码 [英] How to put php code inside opening and closing shortcodes

查看:77
本文介绍了如何在打开和关闭简码中放入php代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个网站上工作,并且我在模板文件中使用具有打开和关闭位置的简码。我想知道是否有可能在短代码之间放置wordpress the_content php标签,并且是否有可能在打开和关闭标签之间放置另一个短代码。

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.

我已经尝试过-

<?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.

推荐答案

看起来好像还有多余的单引号?

looks like you have extra single quotes?

试试:

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

这篇关于如何在打开和关闭简码中放入php代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆