2024/03/21 oxxo 无标签 WordPressでテーマのバージョンを出す関数 functions.php /** * テーマバージョン表示 */ function version_num() { if ( function_exists( 'wp_get_theme' ) ) { $theme_data = wp_get_theme(); } else { $theme_data = wp_get_theme( get_theme_file_path() . '/style.css' ); } $current_version = $theme_data['Version']; return $current_version; }; PHP 使い方 <?php wp_enqueue_style( $handle, $src, $deps, version_num(), $media ); ?>PHP 実際には <?php wp_enqueue_style( 'top', get_theme_file_path() . '/css/top.css', array(), version_num(), 'all' ); ?>PHP oxxo