Php 嵌套短代码不工作(第二级嵌套) [行] [列大小=“八”] [row]你好世界[/row] [行]类别:网络/创作/交互设计[/row] [/列] [column size=“four”]在此处插入内容[/column] [/世界其他地区]
这是我使用的短代码。但是由于某种原因,[row]…[/row]短代码似乎不起作用。 以下是短码函数:Php 嵌套短代码不工作(第二级嵌套) [行] [列大小=“八”] [row]你好世界[/row] [行]类别:网络/创作/交互设计[/row] [/列] [column size=“four”]在此处插入内容[/column] [/世界其他地区],php,wordpress,shortcode,Php,Wordpress,Shortcode,这是我使用的短代码。但是由于某种原因,[row]…[/row]短代码似乎不起作用。 以下是短码函数: [row] [column size="eight"] [row]<h5>HELLO<strong>WORLD</strong></h5>[/row] [row]<h5>CATEGORIES: <strong>WEB / CREATIONS / INTERACTIVE DESIGN</strong>
[row]
[column size="eight"]
[row]<h5>HELLO<strong>WORLD</strong></h5>[/row]
[row]<h5>CATEGORIES: <strong>WEB / CREATIONS / INTERACTIVE DESIGN</strong></h5>[/row]
[/column]
[column size="four"]Insert your content here[/column]
[/row]
function su\u column\u短码($atts,$content=null){
提取(短码)附件(数组)(
“大小”=>“六”
)美元(附件);;
返回“”。su_do_短代码($content,'c')。';
}
函数su_行_短代码($atta=null,$content=null){
返回“”。su_do_短代码($content,'r')。';
}
你所描述的不是一个问题,而是一个事实
不能嵌套Wordpress短代码。如果需要嵌套,则需要自己进行“嵌套”,方法是在自己的短代码内部的“内部”部分应用所有短代码
请参见谢谢hakre!不知道。当然一个人不可能知道一切,也考虑一些谷歌搜索。codex通常有关于wordpress功能的有用信息,因此值得阅读和搜索(在搜索词中添加“codex”)。
function su_column_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'size' => 'six'
), $atts ) );
return '<div class="' . $size . ' columns">' . su_do_shortcode( $content, 'c' ) . '</div>';
}
function su_row_shortcode($atta = null, $content = null ) {
return '<div class="row">'.su_do_shortcode( $content, 'r').'</div>';
}