
如何修复XAMPP错误“MySQL意外关闭”
get_post_format ( $post = null )
get_post_format函数返回文章的格式。文章格式是区分不同类型内容的一种方式,如标准、旁白、图库、视频、音频等。此功能采用一个参数,即文章的ID。如果文章没有格式,则此函数返回false。
检索一个文章的格式slug。
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 ); }