Programmatically Selecting Theme Based on URL – WordPress

function use_mobile_theme( $current_theme ) {
    // If the domain is m.qqq.com and the current theme is 'qqq'
    if ( 'm.qqq.com' === $_SERVER['HTTP_HOST'] && 'qqq' === $current_theme ) {
        // Use the 'qqq-mobile' theme instead
        return 'qqq-mobile';
    } else {
        // Otherwise, keep the current theme
        return $current_theme;
    }
}

add_filter( 'stylesheet', 'use_mobile_theme' );
add_filter( 'template', 'use_mobile_theme' );

Source: plugin development – Programmatically Selecting Theme Based on URL – WordPress Development Stack Exchange