We have template tags and some functions that start with get. Sometimes it would be just nice in themes to do like:
$title = the_title();
to use the html later on. This is just a simplified example, naturally there is some function like get_the_title(); But that works for that function only.
I'm wondering why there is no such function like this:
function get_output() {
$args = func_get_args();
$callback = array_shift($args);
ob_start();
call_user_func_array($callback, $args);
return ob_get_clean();
}
That could convert any function that has output into a returning function:
$title = get_output('the_title');
Any idea why about that has never been thought about? Every theme author or hacker can make use of such, right?
bloginfo()
is paired withget_bloginfo()
to generate a return rather than an echo. There are several other functions that serve the same purpose. My counter question would be, what are you trying to do where you'd need such a global function?