Last active
January 14, 2021 09:15
-
-
Save beingtree/5ed3cd1b3251e7954e77bf07705697cf to your computer and use it in GitHub Desktop.
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
<?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