Closed DanielBakovic closed 11 years ago
Hi. I think we shouldn't load framework at frontend at all. But with current redux version we need redux get() method to get option value, because this is the only way to get new fields with std values.
Hi, Maybe this could be solved when we check the theme version on init. For example when the theme version number isn't available in the database then the default settings should be loaded and added to the database. If there is already a older version in the database then an update function should be called to add new sections with default values. Then on the end of the update / install function there should be an action where we (developer) can hook into. For example do_action('Redux_after_setup') or something like that.
Best regards. Daniel
You're right that the framework shouldn't be loaded in the frontend... There's gotta be a simpler way to do it though.
Thx for the understanding :)
Maybe just compare options from database with 'sections' array.
$fields = array();
foreach ( $this->sections as $section )
foreach ( $section['fields'] as $field )
$fields[$field['id']] = 1;
$diff = array_diff_key ($fields, $this->options);
if ( !empty( $diff ) )
// update database
Hi, when we can expect this fix?
I'm still testing options, anyone who has a suggestion is more than welcome to bring it up, or even build it themselves and submit a pull request!
If all you're trying to do is prevent loading it on the front end, just write an if statement around your require in the functions.php file that says:
if ( is_admin() ){ //require the page }
It won't even try to load it anywhere but in the admin area. Your visitors could load every front end page without having the options framework try to load. Your stored options values would still be retrievable through the get_options function in WordPress.
asheborocreative, agree with you, but your solution doens't work with current version of redux. Currently default options set to db only once - while there is no redux options at db. So new options added after first redux options setting to db could be retrieved only with get()
So we need to rewrite some logic of framework. Now i don't think that we shouldn't load framework at front-end at all, but use some framework function to check if there are some new options at opitons.php, no matter where we - at the admin screen or at the front-end.
I'm still researching this, but haven't found a safe simple way of doing this without completely rewriting the framework. Any suggestions would be welcome...
I've checked the code and I don't see other really elegant solution, too. It's the base design problem but maybe this could work:
Backend
Frontend
That will reduce the memory usage immensely.
how about :
@DanielBakovic @denis0706 @asheborocreative @tridungpham
With 3.0 I have reduced this dramatically. In the past, you were right. Things got loaded like mad. Let me give you an example:
I had a demo theme with 80 different options. I looked at the DB calls going on at each page load, 555. INSANE!
I then optimised 3.0 a ton and I reduced that down to 30 on the options panel and even less on the front-end.
How's that? I think you'll be SUPER please.
Give 3.0 a try next week. I've optimised everything as far as it can go.
Hi, I really like your framework and I was about to use it for my themes but then I saw that each time when WordPress loads all the arrays are initialized and populated with data that are only needed on the backend (section title, sub_desc, desc, options, std). That increases the memory usage and it can slow down sites.
For example these arrays are populated but not really needed on the frontend: $args, $sections and $tabs.
Could you please optimize the framework and load only data that are really needed.
Best regards, Daniel