Changeset 24817
- Timestamp:
- 07/28/2013 08:48:09 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-formats.php
r24693 r24817 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 or formats to check. 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 $prefixed = array(); 50 foreach( $format as $single ) { 51 $prefixed[] = 'post-format-' . sanitize_key( $single ); 52 } 53 54 return has_term( $prefixed, 'post_format', $post ); 47 55 } 48 56
Note: See TracChangeset
for help on using the changeset viewer.