admin管理员组文章数量:1335406
I want to know how what function or hook i can use to create a php function that executes as tags like this
[block] content to be blocked[/block]
my function will start with [start] afftected content goes here [/end] anything inside the start tag and the end tag will be affected by my function, it could a simply unset or hide or exclude kind of function, please i need to include this in my plugin, any suggestions.
I want to know how what function or hook i can use to create a php function that executes as tags like this
[block] content to be blocked[/block]
my function will start with [start] afftected content goes here [/end] anything inside the start tag and the end tag will be affected by my function, it could a simply unset or hide or exclude kind of function, please i need to include this in my plugin, any suggestions.
1 Answer
Reset to default 0You are looking for Enclosing Shortcode. Here is an example of how you can achieve this.
function example_shortcode($atts = [], $content = null)
{
// do something to $content
// run shortcode parser recursively
$content = do_shortcode($content);
// always return
return $content;
}
add_shortcode('example', 'example_shortcode');
Now you can use it like [example] Here is my content [/example]
Read more about add_shortcode()
here
本文标签: phpHow can i create a function tag in my plugin
版权声明:本文标题:php - How can i create a function tag in my plugin 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742358843a2459955.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论