Home>Support>Custom Iris Picker

Custom Iris Picker

Hi
I need to set custom color into Iris Palette, Color Picker.

I tried some code edits but didn’t work.

Could you help me?

https://wordpress.org/support/topic/universally-change-iris-palette

http://automattic.github.io/Iris/

I also tried this code

// customise palette colours
function firefly_customize_controls_print_footer_scripts() {
?>
    <script>
        jQuery(document).ready(function($){
            $.wp.wpColorPicker.prototype.options = {
                palettes: ['#ffffff', '#000000','#dd3333', '#dd9933','#eeee22', '#81d742', '#ff0000']
            };
        });
    </script>
<?php
}
add_action('customize_controls_print_footer_scripts', 'firefly_customize_controls_print_footer_scripts');

that works with the theme, but doesn’t work with your shortcodes.

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 8 years, 7 months ago Alex S
    Hi, I Work Here

    Hi FuoriLuogo,

    That will only change the color pallets in the customizer – nowhere else. If you really want to to be universal you should instead use:

    function siteorigin_universal_color_pallet() {?>    <script>        jQuery(document).ready(function($){            $.wp.wpColorPicker.prototype.options = {                palettes: ['#ffffff', '#000000','#dd3333', '#dd9933','#eeee22', '#81d742', '#ff0000']            };        });    </script><?php}add_action('admin_print_footer_scripts', 'siteorigin_universal_color_pallet');add_action('customize_controls_print_footer_scripts', 'siteorigin_universal_color_pallet');
  2. 8 years, 7 months ago FuoriLuogo Asti

    So I just need to replace this code in the same file of the previous code, deleting the old one.
    Right?

  3. 8 years, 7 months ago Alex S
    Hi, I Work Here

    Hi FuoriLuogo,

    Yes. Is there anything else I can help you with today?

  4. 8 years, 7 months ago FuoriLuogo Asti

    It seems to work with SiteOrigin widgets and shortcodes, great!!

    Is there a way to make it default in every color picker of my website?

  5. 8 years, 7 months ago Alex S
    Hi, I Work Here

    Hi FuoriLuogo,

    It should already be the default. Is it not?

  6. 8 years, 7 months ago FuoriLuogo Asti

    I’m sorry, I mean,
    how to set customized iris color picker default everywhere in my website?

    I mean, replacing your code, now the customizer has wordpress colors and not mine.

    Another plugin, has wordpress colors and not these ones I set as customized.

    Is there a way to make this code (with customized colors), be shown in every color picker and not just in one plugin etc?

    ;)

  7. 8 years, 7 months ago Alex S
    Hi, I Work Here

    Hi FuoriLuogo,

    I guess the customizer acts off of the frontend code rather than the admin code. I’ve got no idea why the other plugin isn’t affected by the other change though seeing as the hook I used is the proper method for doing this sort of stuff. I’ve updated the code above so that it works with the customizer, and likely the other plugin.

  8. 8 years, 7 months ago FuoriLuogo Asti

    I really don’t know.

    thanks anyway

  9. 8 years, 7 months ago Alex S
    Hi, I Work Here

    Hi FuoriLuogo,

    So the above code change didn’t fix the issue?

  10. 8 years, 7 months ago FuoriLuogo Asti

    It works now both with wordpress customizer and siteorigin’s plugins, not in other plugins :(

  11. 8 years, 7 months ago Alex S
    Hi, I Work Here

    Hi FuoriLuogo,

    Just to confirm; did it previously work with the other plugin?

  12. 8 years, 7 months ago FuoriLuogo Asti

    The code I found on my own (on some forums) didn’t work at all even if it worked for other people.

    The code in the first post, provided to me by theme’s author, worked only for the theme, not for plugins (even yours).

    The last code you provided, it works both with theme (and wordpress customizer) and siteorigin’s plugins, not with others.

  13. 8 years, 7 months ago Alex S
    Hi, I Work Here

    Hi FuoriLuogo,

    I’m not too sure what to tell you. The change I made should work in theory for everything (minus the customizer but that was due to an assumption). :S Is there anything else I can help you with?

  14. 8 years, 7 months ago FuoriLuogo Asti

    If you want to see the links in the first post, there is the source I find.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More