Changeset 26350
- Timestamp:
- 11/24/2013 01:44:42 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post-formats.php
r24817 r26350 33 33 34 34 /** 35 * Check if a post has a particular format35 * Check if a post has any of the given formats, or any format. 36 36 * 37 37 * @since 3.1.0 … … 39 39 * @uses has_term() 40 40 * 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 * @return bool True if the post has the format, false otherwise. 44 */ 45 function has_post_format( $format, $post = null ) { 46 if ( ! is_array( $format ) ) 47 $format = array( $format ); 48 41 * @param string|array $format Optional. The format or formats to check. 42 * @param object|int $post Optional. The post to check. If not supplied, defaults to the current post if used in the loop. 43 * @return bool True if the post has any of the given formats (or any format, if no format specified), false otherwise. 44 */ 45 function has_post_format( $format = array(), $post = null ) { 49 46 $prefixed = array(); 50 foreach( $format as $single ) { 51 $prefixed[] = 'post-format-' . sanitize_key( $single ); 47 48 if ( $format ) { 49 foreach ( (array) $format as $single ) { 50 $prefixed[] = 'post-format-' . sanitize_key( $single ); 51 } 52 52 } 53 53
Note: See TracChangeset
for help on using the changeset viewer.