How to Use WordPress’s Iris Colorpicker on the Front End
I learned a few things today: first, that WordPress has a built-in colorpicker called Iris, and second, that you can use it on the front end of your website if you need custom colorpicker functionality.
Iris is evidently actually designed for admin options pages, and so it’s usually included via WordPress’s
admin_enqueue_scripts() calls, as explained in its main documentation (actually a release note from WordPress 3.5 when it was added).
Including the Iris colorpicker on the front end is not as easy as simply changing
wp_enqueue_scripts(). Fortunately, as always, Stack Exchange has an amazing perfect-fitting answer. Please visit the linked thread for the explanation, and here’s the code snippet itself, with comments added:
Enjoy being able to use WordPress’s awesome built-in colorpicker on the front end!
Image credit: evelynishere