Archived topic
How to obtain some configuration values programatically (colors, and so on).
1 reply · Started by Roque Campos on November 26, 2019
Dear Friends,
I'm developing a mobile native app to show some information available on my Wordpress site. The site uses your template, and I would like to dynamically adjust the colors of the app with the colors used in the WordPress site.
And that is my question. Is it possible to read the customizations done to the GP template (colors principally) programmatically?
Then I could write my own rest endpoint and use this endpoint in my app to download the last color settings and that would solve my problem!
Thank you in advance,
R. Campos.
Hi there,
You can for sure.
For example:
$color_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_color_defaults()
);
$nav_background = $color_settings['navigation_background_color'];
You can see all of the available option names here: https://github.com/tomusborne/generatepress/blob/2.4.0/inc/defaults.php#L74
Hope this helps :)