diff --git a/includes/class-newspack-image-credits.php b/includes/class-newspack-image-credits.php index ddd22fbdf2..739dfb4eee 100644 --- a/includes/class-newspack-image-credits.php +++ b/includes/class-newspack-image-credits.php @@ -421,7 +421,8 @@ function( $setting ) use ( $key ) { return $setting['key'] === $key; } ); - return reset( array_values( $setting ) ); + $setting_values = array_values( $setting ); + return reset( $setting_values ); } return $default_settings; @@ -560,7 +561,7 @@ public static function populate_credit( $metadata, $attachment_id, $context ) { */ public static function register_meta() { foreach ( [ - static::MEDIA_CREDIT_META, + static::MEDIA_CREDIT_META, static::MEDIA_CREDIT_URL_META, static::MEDIA_CREDIT_ORG_META, static::MEDIA_CREDIT_CAN_DISTRIBUTE_META, diff --git a/includes/wizards/class-setup-wizard.php b/includes/wizards/class-setup-wizard.php index ac29fb8e3d..61416892bd 100644 --- a/includes/wizards/class-setup-wizard.php +++ b/includes/wizards/class-setup-wizard.php @@ -325,12 +325,14 @@ public function api_retrieve_theme_and_set_defaults() { } } $theme_mods['theme_colors'] = get_theme_mod( 'theme_colors', 'default' ); - if ( 'default' === $theme_mods['theme_colors'] ) { - $theme_mods['primary_color_hex'] = newspack_get_primary_color(); - $theme_mods['secondary_color_hex'] = newspack_get_secondary_color(); - } else { - $theme_mods['primary_color_hex'] = get_theme_mod( 'primary_color_hex', newspack_get_primary_color() ); - $theme_mods['secondary_color_hex'] = get_theme_mod( 'secondary_color_hex', newspack_get_secondary_color() ); + if ( function_exists( '\newspack_get_primary_color' ) ) { + if ( 'default' === $theme_mods['theme_colors'] ) { + $theme_mods['primary_color_hex'] = \newspack_get_primary_color(); + $theme_mods['secondary_color_hex'] = \newspack_get_secondary_color(); + } else { + $theme_mods['primary_color_hex'] = get_theme_mod( 'primary_color_hex', \newspack_get_primary_color() ); + $theme_mods['secondary_color_hex'] = get_theme_mod( 'secondary_color_hex', \newspack_get_secondary_color() ); + } } // Set custom header color to primary, if not set.