Skip to content

Instantly share code, notes, and snippets.

@PurpleHippoDesign
Created June 10, 2019 09:18
Show Gist options
  • Save PurpleHippoDesign/ff5b2a9a4976e77239c953a941c6c51c to your computer and use it in GitHub Desktop.
Save PurpleHippoDesign/ff5b2a9a4976e77239c953a941c6c51c to your computer and use it in GitHub Desktop.
Add colours to ACF colour picker
function themeprefix_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 = ['#F0F4F9', '#FFFBC5']
// return colors
return args;
});
})(jQuery);
</script>
<?php
}
add_action('acf/input/admin_footer', 'themeprefix_acf_input_admin_footer');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment