[Plugin: OptionTree] Settings array direct access
-
Hey there,
Great plugin, love the idea and would be happy to start using it with my themes.
Just a quick best practice question. I’m storing the options returned in an array as suggested to save trips to the db.
Do you forsee any harm is declaring that settings array as global in the header so it can be accessed directly throughout the theme vs. having to check if get_option_tree exists, assign the returned value to an array every single time a value is to be grabbed?
Example – in header.php:
global $theme_options;
if ( function_exists( 'get_option_tree') ) {
$theme_options = get_option('option_tree');
}
Then, in the theme, just referencing: $theme_options[“some_setting”]; instead of:
if ( function_exists( 'get_option_tree') ) {
$some_setting = get_option_tree( 'some_setting', $theme_options, false, false, -1 );
}
Let me know – thanks again!
- The topic ‘[Plugin: OptionTree] Settings array direct access’ is closed to new replies.