Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions includes/class-newspack-image-credits.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
14 changes: 8 additions & 6 deletions includes/wizards/class-setup-wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down