Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_post_format [ WordPress Function ]

get_post_format ( $post = null )
Parameters:
  • (int|object) $post A post
Returns:
  • (mixed) The format if successful. False if no format is set. WP_Error if errors.
Defined at:



Retrieve the format slug for a post

Source


<?php
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 ) );
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics