Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentyseventeen/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,10 @@
$customize_preview_data_hue = '';
if ( is_customize_preview() ) {
$customize_preview_data_hue = 'data-hue="' . $hue . '"';
}

Check failure on line 440 in src/wp-content/themes/twentyseventeen/functions.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Expected 1 space before closing PHP tag; 2 found
?>
<style type="text/css" id="custom-theme-colors" <?php echo $customize_preview_data_hue; ?>>
<?php echo twentyseventeen_custom_colors_css(); ?>
<style type="text/css" id="custom-theme-colors" <?php echo esc_attr( $customize_preview_data_hue ); ?>>
Copy link

@sabernhardt sabernhardt Jan 10, 2025

Choose a reason for hiding this comment

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

Suggested change
<style type="text/css" id="custom-theme-colors" <?php echo esc_attr( $customize_preview_data_hue ); ?>>
<style type="text/css" id="custom-theme-colors" <?php echo $customize_preview_data_hue; ?>>

The $customize_preview_data_hue variable should not be escaped:
<style type="text/css" id="custom-theme-colors" data-hue=&quot;356&quot;>
It is either an empty string or an attribute/value pair like data-hue="356". The absint() function ensures that the hue value is always an integer.


I would also like to move the space before the data-hue attribute inside the $customize_preview_data_hue variable, and the type attribute is unnecessary, but those changes are not important.

	if ( is_customize_preview() ) {
		$customize_preview_data_hue = ' data-hue="' . $hue . '"';
	}
	?>
	<style id="custom-theme-colors"<?php echo $customize_preview_data_hue; ?>>

<?php echo wp_strip_all_tags( twentyseventeen_custom_colors_css() ); ?>

Choose a reason for hiding this comment

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

Suggested change
<?php echo wp_strip_all_tags( twentyseventeen_custom_colors_css() ); ?>
<?php echo wp_strip_all_tags( twentyseventeen_custom_colors_css() ); ?>

The PHP coding standards GitHub action caught that there are two spaces after the semicolon when it should only be one.

</style>
<?php
}
Expand Down
Loading