This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Custom Iris Picker

9 years ago · Last reply by FuoriLuogo Asti 9 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

14
  1. Alex S Staff 9 years, 11 months ago

    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. FuoriLuogo Asti 9 years, 11 months ago

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

  3. Alex S Staff 9 years, 11 months ago

    Hi FuoriLuogo,

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

  4. FuoriLuogo Asti 9 years, 11 months ago

    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. Alex S Staff 9 years, 11 months ago

    Hi FuoriLuogo,

    It should already be the default. Is it not?

  6. FuoriLuogo Asti 9 years, 11 months ago

    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. Alex S Staff 9 years, 11 months ago

    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. FuoriLuogo Asti 9 years, 11 months ago

    I really don’t know.

    thanks anyway

  9. Alex S Staff 9 years, 11 months ago

    Hi FuoriLuogo,

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

  10. FuoriLuogo Asti 9 years, 11 months ago

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

  11. Alex S Staff 9 years, 11 months ago

    Hi FuoriLuogo,

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

  12. FuoriLuogo Asti 9 years, 11 months ago

    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. Alex S Staff 9 years, 11 months ago

    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. FuoriLuogo Asti 9 years, 11 months ago

    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.

Have a different question or issue?

Start New Thread