I’ve enabled custom posts types
add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image' ) );
The default post type is set on Standard
, and it works for all but the Standard
type, when I have a standard post the get_post_format()
return empty. did I miss something in enabling them?
Because “Standard” is not a format itself – it simply implies that the post has no formats.
…which is somewhat deceptive, given it’s listed in the Format meta-box as a format to choose
I think “standard” quite clearly implies what it means. If you’re creating a site in which a post is never “standard”, then fallback to a default:
if ( ! $format = get_post_format() )
$format="gallery";
Alternatively, hook onto wp_insert_post
and enforce a format if one has not already been set.
function wpse_58121_set_default_format( $post_id ) {
if ( ! get_post_format( $post_id ) )
set_post_format( $post_id, 'gallery' );
}