Archived topic
wp customizer
8 replies · Started by Bart on August 1, 2018
Hi,
I'm customizing a generatepress child theme and I was wondering how it is possible to get the settings for the 4 basic colors ?
for example : $wp_customize->get_setting( 'header_textcolor' )->default
https://codex.wordpress.org/Class_Reference/WP_Customize_Manager/get_setting
Thx in advance,
Bart
Hi there,
Would this filter help?
https://docs.generatepress.com/article/generate_default_color_palettes/
Let me know :)
Almost :-)
I would need the colors selected in the customizer, not change them programmatically ...
Bart
One of our staff suggested this might be what you are looking for:
https://en-gb.wordpress.org/plugins/kt-tinymce-color-grid/
Let us know :)
With all respect, but that is not at all what I'm asking.
You are storing the main colors of the theme (setup through the customizer) in the mysql database. Probably serialised.
With I need is a function to retrieve these colors in an array so I can use in in a dynmaically generated css file.
Please show him/her my exact phrase above....
Bart
Hey Bart,
These colors?: https://github.com/tomusborne/generatepress/blob/2.1.3/inc/defaults.php#L47-L50
If so, try this:
$settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
// Background color.
$settings['background_color'];
// Text color.
$settings['text_color'];
// Link color.
$settings['link_color'];
// Link color hover.
$settings['link_color_hover'];
Exact ! Thank you so much
Worked like a charm ...
Thx again
Awesome, glad I could help :)