/** * 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; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter