[Support request] How to obtain some configuration values programatically (colors, and so on).

Home Forums Support How to obtain some configuration values programatically (colors, and so on).

  • This topic has 1 reply, 2 voices, and was last updated 10 months ago by Tom.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1077754
    Roque Campos

    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.

    #1078267
    Tom
    Lead Developer
    Lead Developer

    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 🙂

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.