[英]Wordpress nested shortcodes of same type
http://codex.wordpress.org/Shortcode_API#Nested_Shortcodes-您可以在此處閱讀以下簡短代碼:
[tag-a]
[tag-a]
[/tag-a]
[/tag-a]
不管用。 而且我看不到任何解釋。 所以我的問題是如何制作,並且有可能-在wordpress中創建相同類型的嵌套簡碼嗎?
您可以為相同的shorcode創建不同的別名
add_shortcode('tag','my_shortcode_function');
add_shortcode('sub-tag','my_shortcode_function');
function my_shortcode_function($atts,$content) {
// do things here
}
然后像這樣使用
[tag]
[sub-tag]
[/sub-tag]
[/tag]
它們將執行相同的操作,但是解析器將知道如何關閉它們。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.