我有一个带有一些属性的自定义短代码标签,我希望能够在新行上显示其属性 - 使其对内容编辑器更具可读性:
[component
attr1 ="value1"
attr2 ="value of the second one"
attr3 ="another"
attr4 ="value"
...
attrN ="valueN"]
此要求背后的原因是一些属性的内容可能非常冗长。不幸的是,wpautop()
添加了一些讨厌的额外标记,像这样破坏args
数组(使用 php print_r($args)
):
Array ( [0] => attr1 [1] => ="value1"
/> [3] => attr2 = [4] => "value [5] => of [6] => the [7] => second [8] => one"
/> [10] => "" //...and more like this)
我试过使用属性inline:
[component attr1 ="value1" attr2 ="value of the second one" ="value"... attrN ="valueN"]
并且输出如预期:
Array ( [attr1] => value1 [attr2] => value of the second one [attr3] => //...and so on)
有没有办法让属性有意图并避免破坏$args
数组的额外标记?