hasChildNodes() ) { return $html; } $global_settings = wp_get_global_settings(); $color_palette = $global_settings['color']['palette']['theme'] ?? []; foreach ( $ul->childNodes as $child ) { if ( $child->nodeName === 'li' ) { $styles = css_string_to_array( $child->getAttribute( 'style' ) ); if ( ! $styles['color'] ) { continue; } foreach ( $color_palette as $color ) { if ( trim( $styles['color'] ) === trim( $color['color'] ) ) { $styles['color'] = "var(--wp--preset--color--{$color['slug']})"; $child->setAttribute( 'style', css_array_to_string( $styles ) ); break; } } $child->setAttribute( 'style', css_array_to_string( $styles ) ); } } return $dom->saveHTML(); }