Some newbie problems
First of all, I want to thank you for this great piece of software, its a great tool for creating themes.
Im facing several problems using the framework as a plugin:
When I try to print_r the global variable, it is empty. I have changed the opt_name to my own theme name.
Another thing is, I can change settings, but when I click on save changes, all option tabs get empty. To see something I must click o reset to default to see the tabs again.
Thanks for the patience!
@vertigo7x Thanks!
First, do this anywhere in your theme:
global $OPT_NAME;
print_r($OPT_Name);
?>```
Umm, the second issue I haven't heard of before. Are you getting any errors? Can you provide me with a URL I could go see what you are experiencing? Sorry you're having such trouble. I'll do what I can to help you.
Ok, I solved some problems. Some releated to my theme, some to the framework. Now when I save the changes, I get back all the tabs with content. But I still miss the global var, with all the settings. I use Wordpress get_option to retrieve the settings and they are there.
Are you running Redux as a plugin?
Right now I managed to use it as part of my theme, not as a plugin.
@vertigo7x Take a look at this: https://gist.github.com/dovy/7218241 This is how you want to include redux in a plugin/theme. This way the plugin will always be first initialised so you can be sure that your users have a solid foundation. It will also avoid conflicts.
That being said, we're requesting anyone who embeds Redux to contribute some finances to the project. If you use it as a plugin, there's no requested donation (but it's gladly accepted).
Either way, this should get you well on your way.
@vertigo7x Let me know if that doesn't fix things for you. I'll close this for now.
Everyone, just pushed a fix for Redux. You can use the global variable anywhere without any extra features. It loads properly on the front and backend.
The only exception is within template files you need to put global $OPT_NAME in the header.php as those functions run within another function.
How's that for simplicity?
See the updated sample-config.php to see how to do this. Basically you remove the init function for the redux init. It's not needed now.
Also, if you want to embed redux, now all you have to do is this:
<?php
if ( !class_exists( 'ReduxFramework' ) && file_exists( dirname( __FILE__ ) . '/ReduxFramework/ReduxCore/framework.php' ) ) {
require_once( dirname( __FILE__ ) . '/ReduxFramework/ReduxCore/framework.php' );
}
if ( !isset( $redux_demo ) && file_exists( dirname( __FILE__ ) . '/ReduxFramework/sample/sample-config.php' ) ) {
require_once( dirname( __FILE__ ) . '/ReduxFramework/sample/sample-config.php' );
}
It will work as you'd expect. Hope that helps.