Last active
January 9, 2023 03:49
-
-
Save marcwieland95/f54ec87e95d494ac0f283c6c21f67e98 to your computer and use it in GitHub Desktop.
Style ACF fields as deprecated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Admin | |
{ | |
public function __construct() | |
{ | |
add_action('admin_enqueue_scripts', [$this, 'acfDeprecationStyles'], 10, 2); | |
} | |
public function acfDeprecationStyles() | |
{ | |
echo '<style type="text/css">'; | |
echo $this->generateAcfDeprecationStylings(); | |
echo '</style>'; | |
} | |
private function generateAcfDeprecationStylings() | |
{ | |
$style = ''; | |
$style .= '.acf-field.deprecated { | |
opacity: .8; | |
}'; | |
$style .= '.acf-field.deprecated .acf-label label { | |
color: red; | |
}'; | |
return $style; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simply add
deprecated
to the class setting in the ACF field (in the admin) and the field will be shown red and a bit transparent for the user.