WordPress Post Formats Adding post type to Theme


Example

Add post-formats to post_type 'page'

add_post_type_support( 'page', 'post-formats' );

Next example registers custom post type 'my_custom_post_type', and add Post Formats.

Register custom post type 'my_custom_post_type'

add_action( 'init', 'create_my_post_type' );
function create_my_post_type() {
    register_post_type( 'my_custom_post_type',
      array(
        'labels' => array( 'name' => __( 'Products' ) ),
        'public' => true
    )
  );
}

Add post-formats to post_type 'my_custom_post_type'

add_post_type_support( 'my_custom_post_type', 'post-formats' );

Or in the function register_post_type(), add 'post-formats', in 'supports' parameter array. Next example is equivalent to above one.

Register custom post type 'my_custom_post_type' with 'supports' parameter

add_action( 'init', 'create_my_post_type' );
function create_my_post_type() {
    register_post_type( 'my_custom_post_type',
      array(
        'labels' => array( 'name' => __( 'Products' ) ),
        'public' => true,
        'supports' => array('title', 'editor', 'post-formats')
    )
  );
}