[英]Putting a wordpress shortcode inbetween another wordpress shortcode
Essentially I want to use a short code at some predetermined point in another short code. 本质上,我想在另一个短代码中的某个预定点使用短代码。 My original Shortcode is grabbing a big chunk of text and I want to stick the next shortcode in at some point for a pull quote. 我原来的Shortcode占用了大量文本,我想在某个时候粘贴下一个shortcode以获取引号。
The only way I can think of is to use javascript to parse the original shortcode on page load for a certain character and insert the shortcode after that. 我能想到的唯一方法是使用javascript在页面加载时解析某个字符的原始简码,然后在其后插入简码。
Is this possible? 这可能吗?
From the Codex on nesting shortcodes : 从法典上的嵌套简码 :
The shortcode parser correctly deals with nested shortcode macros, provided their handler functions support it by recursively calling
do_shortcode()
: 短代码解析器可以正确处理嵌套的短代码宏,前提是它们的处理函数通过递归调用do_shortcode()
支持它:
[tag-a]
[tag-b]
[tag-c]
[/tag-b]
[/tag-a]
However the parser will fail if a shortcode macro is used to enclose another macro of the same name: 但是,如果使用shortcode宏来封装另一个同名的宏,则解析器将失败:
[tag-a]
[tag-a]
[tag-c]
[/tag-a]
[/tag-a]
Long story short: you can do this, as long as you follow the above rule. 长话短说:只要遵守上述规则,您就可以这样做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.