Definition:
function get_post_format( $post = null ) {}
Retrieve the format slug for a post
Parameters
- int|object $post: A post
Return values
returns:The format if successful. False if no format is set. WP_Error if errors.
Source code
function get_post_format( $post = null ) { $post = get_post($post); if ( ! post_type_supports( $post->post_type, 'post-formats' ) ) return false; $_format = get_the_terms( $post->ID, 'post_format' ); if ( empty( $_format ) ) return false; $format = array_shift( $_format ); return ( str_replace('post-format-', '', $format->slug ) ); }
9585
No comments yet... Be the first to leave a reply!