wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes
get_post_format › WordPress Function
Depuis3.1.0
Dépréciéen/a
› get_post_format ( $post = null )
| Paramètres: |
|
| Retourne: |
|
| Défini(e) dans: |
|
| Codex: |
Retrieve the format slug for a post
Fonctions en relation: set_post_format, get_post_format_link, get_post_format_slugs, get_post_format_string, has_post_format
Source
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 );
}