Вы можете попробовать проверить, содержит ли запрошенный URI строку, идентифицирующую ваш «подузел».
Код теперь расширен до демо-версии else, elesif и "or", чтобы охватить последующие вопросы в комментариях. вопросы в комментариях.
function wpdocs_theme_name_scripts() {
global $post;
$perma = get_permalink( $post->ID ); // or use get_page_uri??
if (strpos($perma, '/two/') !== false || strpos($perma, '/anything/') !== false) {
wp_enqueue_style('two', get_template_directory_uri().'/two.css',false,'1','screen' );
}
elseif (strpos($perma, '/THREE/') !== false) {
wp_enqueue_style('three', get_template_directory_uri().'/THREE.css',false,'1','screen' );
}
else { // if you want to enqueue some default CSS for all other pages
wp_enqueue_style('default', get_template_directory_uri().'/default.css',false,'1','screen' );
}
}
add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );