- This topic has 3 replies, 2 voices, and was last updated 3 years, 10 months ago by
Tom.
-
AuthorPosts
-
June 10, 2017 at 5:04 am #331486
James
I’m working with the Central Color Palette plugin but it doesn’t work on the GP Customizer Alpha pickers.
print_r(array_column( get_option( 'kt_color_grid_palette' ), '0' ));
Prints this but no #
Array ( [0] => C40082 [1] => 0029E2 [2] => A7C900 [3] => 009E90 [4] => 00E5D6 [5] => 00337F [6] => 00DBA8 [7] => 00EA07 [8] => 00BC06 [9] => 007703 )
Apparently Central Color Palette doesn’t prefix the #.
This works but wondering if there might be a better way?
add_filter( 'generate_default_color_palettes', 'gp_ccp_color_palettes', 10 ); function gp_ccp_color_palettes( $palettes ) { $palettes = array_column( get_option( 'kt_color_grid_palette' ), '0' ); foreach ( $palettes as &$hexclr ) { $hexclr = '#' . $hexclr; } return $palettes; }
Here’s the contents of ‘kt_color_grid_palette’ option.
a:11:{ i:0;a:2:{i:0;s:6:"c40082";i:1;s:0:"";} i:1;a:2:{i:0;s:6:"0029e2";i:1;s:0:"";} i:2;a:2:{i:0;s:6:"a7c900";i:1;s:0:"";} i:3;a:2:{i:0;s:6:"009e90";i:1;s:0:"";} i:4;a:2:{i:0;s:6:"00e5d6";i:1;s:0:"";} i:5;a:2:{i:0;s:6:"00337f";i:1;s:0:"";} i:6;a:2:{i:0;s:6:"00dba8";i:1;s:0:"";} i:7;a:2:{i:0;s:6:"00ea07";i:1;s:0:"";} i:8;a:2:{i:0;s:6:"00bc06";i:1;s:0:"";} i:9;a:2:{i:0;s:6:"007703";i:1;s:0:"";} }
GeneratePress 1.3.48GP Premium 1.3June 10, 2017 at 9:13 am #331607Tom
Lead DeveloperLead DeveloperDo the GP color pickers care if there’s no #? Usually they will just add it for you.
If they do, then your code looks like it should work.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJune 10, 2017 at 1:31 pm #331710James
That’s whole the problem the GP Customizer Alpha pickers do care and they don’t add it for you, hence my hacky code (did you even look at the code?). The WP pickers work fine with Central Color Palette.
Central Color Palette is a very useful plugin so I guess I’ll make this a request: It would be nice if the GP Alpha pickers worked with Central Color Palette.
Thanks!
June 11, 2017 at 12:22 am #331839Tom
Lead DeveloperLead DeveloperI’ll definitely look into it – first I’ve ever heard of it.
Is the function you posted here not working for you?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.