Add CPT to homepage / blog page

If you want to add your custom post type (in this case mycpt) to the homepage or blog page in WordPress, add this snippet to your functions.php:

add_filter( 'pre_get_posts', 'wpkb_get_posts' );

function wpkb_get_posts( $query ) {
    if ( is_home() && $query->is_main_query() ) {
        $query->set( 'post_type', array( 'post', 'mycpt' ) );
    }

    return $query;
}

If you also want to add the custom post type to your feed, use this snippet:

add_filter( 'pre_get_posts', 'wpkb_get_posts' );

function wpkb_get_posts( $query ) {
    if ( ( is_home() && $query->is_main_query() ) || is_feed() ) {
        $query->set( 'post_type', array( 'post', 'mycpt' ) );
    }

    return $query;
}