Output edited shortcode content, not return it
is it possible somehow to execute / print content in a WordPress shortcode filter, not return it? I mean, shortcode functions in general return output, but do not print. If I tell my shortcode f开发者_开发百科unction to print, it outputs the worked trough shortcode content right in the beginning of all content and I don not have any possibility to work with it any more.
I really hope, someone can help me, if someony has understood what I mean ;)
Best regards, .wired
Easy! Use output buffering.
ob_start(); // content is no longer output but is captured internally
echo 'buffered output'; // business as usual
$output = ob_get_contents(); // pass captured content to variable and
// terminate output buffering (echo beyond this point prints again)
return $output; // or play with it some more
PHP rules!
精彩评论