getAttribute( 'class' ) ); $styles = css_string_to_array( $first->getAttribute( 'style' ) ); if ( $width['mobile'] ?? null ) { $styles['--wp--custom--width--mobile'] = $width['mobile']; } if ( $width['desktop'] ?? null ) { $styles['--wp--custom--width--desktop'] = $width['desktop']; } if ( ! in_array( 'has-custom-width', $classes, true ) ) { $classes[] = 'has-custom-width'; } unset( $styles['width'] ); $first->setAttribute( 'style', css_array_to_string( $styles ) ); $first->setAttribute( 'class', implode( ' ', $classes ) ); return $dom->saveHTML(); }