wpseek.com
WordPress开发者和主题制作者的搜索引擎
get_post_format › WordPress Function
Since3.1.0
已弃用n/a
› get_post_format ( $post = null )
参数: |
|
返回: |
|
定义在: |
|
文档: |
Retrieve the format slug for a post
Related Functions: set_post_format, get_post_format_link, get_post_format_slugs, get_post_format_string, has_post_format
源码
function get_post_format( $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } 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 = reset( $_format ); return str_replace( 'post-format-', '', $format->slug ); }