Fix - theme_api check as an object first
This commit is contained in:
parent
2a4a1bc9a8
commit
b0432827f5
|
@ -301,24 +301,25 @@ class WC_Admin_Status {
|
|||
|
||||
/**
|
||||
* Get latest version of a theme by slug.
|
||||
* @param object $theme WP_Theme object
|
||||
* @return string Version number if found
|
||||
* @param object $theme WP_Theme object.
|
||||
* @return string Version number if found.
|
||||
*/
|
||||
public static function get_latest_theme_version( $theme ) {
|
||||
$api = themes_api( 'theme_information', array(
|
||||
'slug' => $theme->get_stylesheet(),
|
||||
'fields' => array(
|
||||
'sections' => false,
|
||||
'tags' => false
|
||||
) ) );
|
||||
'sections' => false,
|
||||
'tags' => false,
|
||||
)
|
||||
) );
|
||||
|
||||
$update_theme_version = 0;
|
||||
|
||||
// Check .org for updates
|
||||
if ( $api && ! is_wp_error( $api ) ) {
|
||||
// Check .org for updates.
|
||||
if ( is_object( $api ) && ! is_wp_error( $api ) ) {
|
||||
$update_theme_version = $api->version;
|
||||
|
||||
// Check WooThemes Theme Version
|
||||
// Check WooThemes Theme Version.
|
||||
} elseif ( strstr( $theme->{'Author URI'}, 'woothemes' ) ) {
|
||||
$theme_dir = substr( strtolower( str_replace( ' ','', $theme->Name ) ), 0, 45 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue