Allow has_post_format() to accept an array of formats to check. props ericmann. fixes .

git-svn-id: https://develop.svn.wordpress.org/trunk@24817 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2013-07-28 20:48:09 +00:00
parent 127c229182
commit 7eda325f58

@ -38,12 +38,20 @@ function get_post_format( $post = null ) {
*
* @uses has_term()
*
* @param string $format The format to check for.
* @param object|int $post The post to check. If not supplied, defaults to the current post if used in the loop.
* @param string|array $format The format or formats to check.
* @param object|int $post The post to check. If not supplied, defaults to the current post if used in the loop.
* @return bool True if the post has the format, false otherwise.
*/
function has_post_format( $format, $post = null ) {
return has_term('post-format-' . sanitize_key($format), 'post_format', $post);
if ( ! is_array( $format ) )
$format = array( $format );
$prefixed = array();
foreach( $format as $single ) {
$prefixed[] = 'post-format-' . sanitize_key( $single );
}
return has_term( $prefixed, 'post_format', $post );
}
/**