Skip to content

Instantly share code, notes, and snippets.

@thadallender
Created July 15, 2013 14:08
Show Gist options
  • Save thadallender/6000212 to your computer and use it in GitHub Desktop.
Save thadallender/6000212 to your computer and use it in GitHub Desktop.
Derive version number from WordPress theme style.css
<?php
/**
* Get theme version number from WP_Theme object (cached)
*/
function gpp_get_theme_version() {
$theme_file = get_template_directory() . '/style.css';
$theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );
return $theme->get( 'Version' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment