Created
September 16, 2013 13:05
-
-
Save prionkor/6580442 to your computer and use it in GitHub Desktop.
Theme updater
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
theme updater add_action( 'init', 'kit_check_theme_update' ); | |
function kit_check_theme_update(){ | |
$versionInfo = 'http://kallzu.s3.amazonaws.com/_kallzu_wp_updates/ppl-ninja/meta.json'; | |
$theme = $theme_data = is_child_theme() ? wp_get_theme()->parent() : wp_get_theme(); | |
$themeDir = $theme->Template; | |
$updater = new ThemeUpdateChecker( $themeDir, $versionInfo ); | |
$updater->addResultFilter( 'show_data' ); | |
$updater->checkForUpdates(); | |
} | |
function show_data($data){ | |
log_it( $data ); | |
} | |
if(!function_exists('log_it')){ // requires define( 'WP_DEBUG_LOG', true ); and Debug mode on | |
function log_it( $message ) { | |
if( WP_DEBUG === true ){ | |
if( is_array( $message ) || is_object( $message ) ){ | |
error_log( print_r( $message, true ) ); | |
} else { | |
error_log( $message ); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment