firstChild; if ( ! $first ) { return $content; } $styles = css_string_to_array( $first->getAttribute( 'style' ) ); $styles['color'] = "var(--wp--preset--color--$textColor)"; $first->setAttribute( 'style', css_array_to_string( $styles ) ); $classes = explode( ' ', $first->getAttribute( 'class' ) ); $classes[] = 'has-text-color'; $first->setAttribute( 'class', implode( ' ', $classes ) ); $content = $dom->saveHTML(); } return $content; }