Skip to content

Instantly share code, notes, and snippets.

@beingtree
Last active January 14, 2021 09:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beingtree/5ed3cd1b3251e7954e77bf07705697cf to your computer and use it in GitHub Desktop.
Save beingtree/5ed3cd1b3251e7954e77bf07705697cf to your computer and use it in GitHub Desktop.
<?php
/* .... some other theme functions ... */
/* Custom Default Colors for WP Colorpicker */
function theme_name_color_palettes() {
if(wp_script_is('wp-color-picker', 'enqueued') ){
?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery.wp.wpColorPicker.prototype.options = {
palettes: ['#ffffff', '#000000', '#bdd54a', '#b0dfe4', '#f192bc']
};
});
</script>
<?php
}
}
add_action('admin_footer', 'theme_name_color_palettes');
add_action('customize_controls_print_footer_scripts', 'theme_name_color_palettes');
/* .... possibly more theme functions ... */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment