-
-
Save jasperf/4ae47bdf1b8f7b70f266cd28727464f8 to your computer and use it in GitHub Desktop.
Customize the ACF color picker in your theme and have it load colors of your liking as swatches
This file contains hidden or 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
<?php | |
/** | |
* Add brand color palette to acf color picker | |
* https://www.advancedcustomfields.com/resources/javascript-api/#filters-color_picker_args | |
* | |
*/ | |
function kronos_acf_input_admin_footer() { | |
?> | |
<script type="text/javascript"> | |
(function($) { | |
acf.add_filter('color_picker_args', function( args, $field ){ | |
args.palettes = ["#000000","#CCCCCC","#EEEEEE","#FFFFFF","#b9ad33","#4c92af","#79c0a6"] | |
return args; | |
}); | |
})(jQuery); | |
</script> | |
<?php } | |
add_action('acf/input/admin_footer', 'kronos_acf_input_admin_footer'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment