using twice or as many as times in theme or in plugins
Hi How can I create instances of this framework? Let I have this framework in theme now I will again use this in plugin.How can I do this?Again let I have to use this in other plugins as well. How the settings work?I mean does it create new settings with different names?
How can I create instances of this framework?
You can't create multiple instances, only one instance is created automatically when you include the framework/bootstrap.php file
Let I have this framework in theme now I will again use this in plugin. How can I do this?
You can include the framework/bootstrap.php file multiple times, but it will have effect only when included first time. It detects, if it's already loaded then it does nothing.
For example you can have the framework as a plugin, but also include it from the theme functions.php (like it is now). In this case, only the plugin version will be active, that from the theme will be ignored
Again let I have to use this in other plugins as well. How the settings work? I mean does it create new settings with different names?
It stores the settings in the same place, in the fw_options option. On every settings save, it will array_merge old settings with new values
If you want an option to be unique for your theme, use the theme id in the option id
$theme_id = fw()->theme->manifest->get_id();
$options = array(
'shared_option' => array('type' => 'text'),
$theme_id .'_theme_unique_option' => array('type' => 'text'),
);
If you have some suggestions, please let us know.
thank you