Skip to content

Instantly share code, notes, and snippets.

@yuka2py
Last active August 29, 2015 13:55
Show Gist options
  • Save yuka2py/8698134 to your computer and use it in GitHub Desktop.
Save yuka2py/8698134 to your computer and use it in GitHub Desktop.
WordPress の the_*() 関数で出力される値を、文字列として取得する簡単な関数。要るのかな?
<?php
if ( ! function_exists( 'get_the' ) ) {
function get_the( $func ) {
$func = 'the_' . $func;
$args = func_get_args();
array_shift($args);
ob_start();
call_user_func_array( $func, $args );
return ob_get_clean();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment