/**
* Add Album post type
*
*/
function create_posttype() {
register_post_type( 'album',
// CPT Options
array(
'labels' => array(
'name' => __( 'album' ),
'singular_name' => __( 'album' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'album'),
)
);
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );
/**
* Show Album post type with Blog pages
*
*/
add_filter( 'pre_get_posts', 'my_get_posts' );
function my_get_posts( $query ) {
if ( is_home() && $query->is_main_query() )
$query->set( 'post_type', array( 'post', 'album') );
return $query;
}