Skip to content

Theme Compatibility: Catch Twenty Twenty PHP warning #43520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 20, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Theme Compatibility: Prevent warning when custom color value isn't set.
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,16 @@ function twentytwenty_enqueue_jetpack_style() {
* Add inline custom CSS with custom accent color if there is any set.
*/
function twentytwenty_infinity_accent_color_css() {
$color_info = get_theme_mod( 'accent_accessible_colors' );

// Bail early if no custom color was set.
if (
'custom' !== get_theme_mod( 'accent_hue_active' )
|| empty( get_theme_mod( 'accent_accessible_colors' ) )
'custom' !== get_theme_mod( 'accent_hue_active' )
|| empty( $color_info )
) {
return;
}

$color_info = get_theme_mod( 'accent_accessible_colors' );
$custom_css = sprintf(
'
.infinite-scroll #site-content #infinite-handle span button,
Expand All @@ -124,7 +125,7 @@ function twentytwenty_infinity_accent_color_css() {
}
',
$color_info['content']['accent'],
$color_info['content']['background'],
$color_info['content']['background'] ?? '#fff',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Themes always set the other two, just not this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a per-theme setting, so we don't care about other themes, but this theme sets defaults for the other two properties, yes:
https://github.com/wordpress/twentytwenty/blob/master/classes/class-twentytwenty-customize.php#L152

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, duh, "projects/plugins/jetpack/modules/theme-tools/compat/twentytwenty.php" 😅

$color_info['content']['secondary']
);

Expand Down
Loading