has_post_format(). see #14746
git-svn-id: http://svn.automattic.com/wordpress/trunk@15778 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0982c3c0f9
commit
d753847050
|
@ -491,6 +491,21 @@ function get_post_format( $post ) {
|
|||
return ( str_replace('post-format-', '', $format[0]) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a post has a particular format
|
||||
*
|
||||
* @since 3.1
|
||||
*
|
||||
* @uses has_term()
|
||||
*
|
||||
* @param string $format The format to check for
|
||||
* @param object|id $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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a format to a post
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue