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