Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

Getting option variable in functions.php

Open webangon opened this issue 11 years ago • 2 comments

Hi I have used this code to get option value in footer.php . My question is how can I access this variable in functions.php?

Thanks $font=fw_get_db_settings_option('google_font'); echo $font['color']; var_dump($font);

webangon avatar Mar 17 '15 15:03 webangon

functions.php is loaded before Unyson is ready. When the framework is loaded, it fires an action fw_init. So add in functions.php this:

function _action_theme_fw_init_test() {
    $font = fw_get_db_settings_option('google_font');
    echo $font['color'];
    var_dump($font);
}
add_action('fw_init', '_action_theme_fw_init_test');

ghost avatar Mar 17 '15 16:03 ghost

Thanks a lot. +1 for explanation .

webangon avatar Mar 17 '15 17:03 webangon