Created
June 10, 2019 09:18
-
-
Save PurpleHippoDesign/ff5b2a9a4976e77239c953a941c6c51c to your computer and use it in GitHub Desktop.
Add colours to ACF colour picker
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
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