wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



maybe_hash_hex_color › WordPress Function

Od3.4.0
Przestarzałyn/a
› maybe_hash_hex_color ( $color )
Parametry:
  • (string) $color The color value to add the hash prefix to. Can be with or without a #.
    Wymagane: Tak
Powrót:
  • (string) The color with the hash prefix if it's a valid hex color,
    otherwise the original value.
Zdefiniowane na:
Codex:

Ensures that any hex color is properly hashed.

Otherwise, returns value untouched. This method should only be necessary if using sanitize_hex_color_no_hash().


Źródło

function maybe_hash_hex_color( $color ) {
	$unhashed = sanitize_hex_color_no_hash( $color );
	if ( $unhashed ) {
		return '#' . $unhashed;
	}

	return $color;
}