Ticket #17320: 17320.1.diff
File 17320.1.diff, 1.0 KB (added by , 10 years ago) |
---|
-
wp-includes/post-formats.php
38 38 * 39 39 * @uses has_term() 40 40 * 41 * @param string $format The format to check for.42 * @param object|int $postThe post to check. If not supplied, defaults to the current post if used in the loop.41 * @param string|array $format The format to check for. 42 * @param object|int $post The post to check. If not supplied, defaults to the current post if used in the loop. 43 43 * @return bool True if the post has the format, false otherwise. 44 44 */ 45 45 function has_post_format( $format, $post = null ) { 46 return has_term('post-format-' . sanitize_key($format), 'post_format', $post); 46 if ( ! is_array( $format ) ) { 47 $format = array( $format ); 48 } 49 50 $prefixed = array(); 51 foreach( $format as $single ) { 52 $prefixed[] = 'post-format-' . sanitize_key( $single ); 53 } 54 55 return has_term( $prefixed, 'post_format', $post ); 47 56 } 48 57 49 58 /**