🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
``` /** * Function to make it possible to query on is_post_type() * * source: http://wordpress.stackexchange.com/a/22166/2015 */ function is_post_type( $type ) { global $wp_query; if ( $type == get_post_type( $wp_query->post->ID) ) return true; return false; } /** * EXAMPLE * Now you can enqueue styles or scripts only for a specific Custom Post Type */ if ( is_single() && is_post_type( 'cpt-name' ) ) { // the script and/or style you want to enqueue } ```