Created
November 10, 2023 12:34
-
-
Save PluginRepublicSupport/b1e041a677fea4efd66b09d3905a5337 to your computer and use it in GitHub Desktop.
Set predefined color palettes in the color picker
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 | |
add_action( 'wp_footer', function() { | |
?> | |
<script> | |
jQuery(document).ready(function($) { | |
let apc = $('.apaou-customer-fields').find('.apaou-color-field').get(0); | |
// Specify your color palettes here | |
let colorPalettes = ['#000', '#000', '#000', '#fff', '#ff0']; | |
// Convert the array to a JSON string and set it as the data-palettes attribute | |
apc.dataset.palettes = JSON.stringify(colorPalettes); | |
}); | |
</script> | |
<?php | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment