Created
July 9, 2019 17:43
-
-
Save SteveJonesDev/4de243342a44a567fd333e758a6b4733 to your computer and use it in GitHub Desktop.
Add Custom Color Palette to ACF Pro Color Picker Field
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
function sjd_acf_input_admin_footer() { | |
?> | |
<script type="text/javascript"> | |
(function($) { | |
acf.add_filter('color_picker_args', function( args, $field ){ | |
// add the hexadecimal codes here for the colors you want to appear as swatches | |
args.palettes = ['#ffffff','#000000'] | |
// return colors | |
return args; | |
}); | |
})(jQuery); | |
</script> | |
<?php | |
} | |
add_action('acf/input/admin_footer', 'sjd_acf_input_admin_footer'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment