Skip to content

Commit 2ac16f4

Browse files
scruffianadamziel
andauthored
Global Styles: Add support for heading elements (#41981)
* Global Styles: Add support for heading elements * Collect element style nodes in the order they're defined in ELEMENTS and not in theme.json Co-authored-by: Adam Zieliński <adam@adamziel.com>
1 parent 9df5714 commit 2ac16f4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class WP_Theme_JSON_6_1 extends WP_Theme_JSON_6_0 {
3232
*/
3333
const ELEMENTS = array(
3434
'link' => 'a:not(.wp-element-button)',
35+
'heading' => 'h1, h2, h3, h4, h5, h6',
3536
'h1' => 'h1',
3637
'h2' => 'h2',
3738
'h3' => 'h3',
@@ -342,8 +343,10 @@ protected static function get_style_nodes( $theme_json, $selectors = array() ) {
342343
);
343344

344345
if ( isset( $theme_json['styles']['elements'] ) ) {
345-
346-
foreach ( $theme_json['styles']['elements'] as $element => $node ) {
346+
foreach ( self::ELEMENTS as $element => $selector ) {
347+
if ( ! isset( $theme_json['styles']['elements'][ $element ] ) ) {
348+
continue;
349+
}
347350

348351
// Handle element defaults.
349352
$nodes[] = array(

0 commit comments

Comments
 (0)