I wonder how can I retrieve my settings in my theme’s functions.php file? Normally, I would just need to use the codes below to get my settings:
global $data
$something = $data['something'];
However, when I do that in my functions.php file, it will not work. Has anyone discovered any way to obtain the settings set by SMOF in that file so that I can use it in my post edit page?
The $data variable is set somewhere in the admin-interface file, so if you try to use $data before they were queued in functions.php (and therefore not defined yet) then you won’t be getting any values.
You have two ways to solve this:
1 - queue SMOF at the very top of your functions.php, or at least before where you to start be able to use $data
2 - define a new var e.g $my_data = get_options(‘my-options-name’);
The caveat for the second method is that it will always get the “old” data from the table, instead of the newer one the options were updated. Therefore I’d recommend #1 as it’s also a lot easier too.
Thanks for your reply. Unfortunately, the first method didn’t work for me. So, I am now using get_option to retrieve the settings from SMOF (in an array) and it seems to update correctly to the latest settings.
I tried your code, but it didn’t worked. I did a ‘print_r’ just after the require part and it seems that the array is not full with all the keys and values. It fills itself completely just after I click on “Options Reset” - but I have to do this on every new installation of the theme
A function like this (written in functions.php)
function my_register_googlefonts() {
global $smof_data;
if( $smof_data['body_google_checkbox'] ) {
....
}
}
… gives me “Undefined index: body_google_checkbox”
I’ve also declared the global variable in header.php and footer.php, because I’m using it in some functions there.
When i activate the SMOF on my custom wordpress theme, why i see this message :
“Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\smof\wp-content\themes\twentyfifteen\admin\functions\functions.filters.php on line 23”
And when I replace it with my own Options Panel, SMOF not work properly.
When i activate the SMOF on my custom wordpress theme, why i see this message :
“Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\smof\wp-content\themes\twentyfifteen\admin\functions\functions.filters.php on line 23”
And when I replace it with my own Options Panel, SMOF not work properly.
Please Reply This Message. Thanks a lot.
Hi, you might want to switch to Redux Framework since the development on SMOF has ceased after it’s joined with Redux.
I also have tried Redux Framework, but I still can not get a good Performance, after I turn on first, background WordPress theme I changed, and I am still confused how to use it.
I also have tried Redux Framework, but I still can not get a good Performance, after I turn on first, background WordPress theme I changed, and I am still confused how to use it.
Smof will be revived very soon with some extra options.
I also have tried Redux Framework, but I still can not get a good Performance, after I turn on first, background WordPress theme I changed, and I am still confused how to use it.
Smof will be revived very soon with some extra options.
Really? It’s written on the GitHub page that SMOF has merged with Redux with no mention of having it revived.
I also have tried Redux Framework, but I still can not get a good Performance, after I turn on first, background WordPress theme I changed, and I am still confused how to use it.
Smof will be revived very soon with some extra options.
Really? It’s written on the GitHub page that SMOF has merged with Redux with no mention of having it revived.
All that I can say now is that new smof is up and running, has new fields like combobox, group and repeatable field. Also it’s extemely small, it has only 300 kb ( 80kb compressed ).
All that I can say now is that new smof is up and running, has new fields like combobox, group and repeatable field. Also it’s extemely small, it has only 300 kb ( 80kb compressed ).
I wonder whether it’s been released yet? I just asked Syamil (the developer of SMOF) and he wasn’t aware of such project at all. Would love to see how it looks when this new version is released to the public.
All that I can say now is that new smof is up and running, has new fields like combobox, group and repeatable field. Also it’s extemely small, it has only 300 kb ( 80kb compressed ).
I wonder whether it’s been released yet? I just asked Syamil (the developer of SMOF) and he wasn’t aware of such project at all. Would love to see how it looks when this new version is released to the public.
It hasn’t been released yet. Options panel implementation has been finished. Currently metabox, widget and shortcode implementation is being developed.
Also there will be new version of Aqua Page Builder but it will use wordpress widgets and support grid systems like foundation and bootstrap.