Php 如何使用此格式从短代码中提取短代码:
如果您有这样创建的短代码:Php 如何使用此格式从短代码中提取短代码:,php,wordpress,shortcode,Php,Wordpress,Shortcode,如果您有这样创建的短代码: [shortcode1 attribute1="content" attribute2="content with [shortcode2] too"] 因为shortcode2是以这种方式使用的,所以它正在破坏shortcode1。如何提取attribute2内容,然后执行shortcode2 目前,我正在提取如下属性: [shortcode1 attribute1="content" attribute2="content with [shortcode2] t
[shortcode1 attribute1="content" attribute2="content with [shortcode2] too"]
因为shortcode2是以这种方式使用的,所以它正在破坏shortcode1。如何提取attribute2内容,然后执行shortcode2
目前,我正在提取如下属性:
[shortcode1 attribute1="content" attribute2="content with [shortcode2] too"]
extract(短码)\u atts(数组(
“attribute1'=>”,
“attribute2'=>”,$atts))代码>
但是在属性中使用shortcode2会完全破坏输出
有人知道怎么做吗?
谢谢当您从第一次短码函数调用返回时,需要调用do\u shortcode()
以获取attribute2
的内容
比如do_shortcode($atts['attribute2'])代码>
谢谢你,但我该在哪里应用呢?因为如果我在提取属性后使用您的确切语法对属性进行var_转储,它就不起作用了,它只输出“content with”部分,而忽略了shortcode2+下面的内容(“太”),我认为这是因为第二个shortcode的方括号正在破坏第一个,这有什么道理吗?@user2413333看一看