I’m registering a shortcode with the following:
class Resource extends Shortcode
{
public function action($atts, $content = "broken")
{
$markup = "<span id='examp'> $content </span>";
return $markup;
}
}
$resource = new Resource;
$resource->register();
in $resource->action(...)
$content is being set to empty string regardless of the value in the shortcode.
The full code samples can be found for Shortcode and Resource
I’m having literally no other problems with this. The $attr parameter is exactly as it should be and the only thing displayed is the $content value with no additional markup.
If this isn’t enough information I’ll share the repository – just let me know if it’d help.
Example input:
asdf[resource_download]abc[/resource_download]asdf
Expected Ouput:
asdf<span id='examp'>abc</span>asdf
Actual Output:
asdfabcasdf
As @uÉÉ¥ÊÉá´ combined efforts the problem we found was,
stealshortcode
method is being called for another short-code class (Video as opposed to Resource). Video is setting that pattern to match all[(.*?)]
which is setting the content to null before Resource has a chance to receive it.Basically
stealshortcode
is called from the parent class which clear’s the shortocde data.