Skip to content

Instantly share code, notes, and snippets.

@colinbm
Created April 2, 2012 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colinbm/2282350 to your computer and use it in GitHub Desktop.
Save colinbm/2282350 to your computer and use it in GitHub Desktop.
Class to wrap WordPress functions and return instead of echo
<?php
class WpGet {
public static function __callStatic($name, $args) {
if (function_exists($name)) {
ob_start();
$name($args);
$result = ob_get_contents();
ob_end_clean();
return $result;
}
return false;
}
}
$title = WpGet::single_tag_title();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment