0
votes

I have created a theme and embed the redux framework with this code

 if ( !class_exists( 'ReduxFramework' ) && file_exists( dirname( __FILE__ ) . '/ReduxFramework/ReduxCore/framework.php' ) ) {
        require_once( WPESTATE_PLUGIN_PATH . '/ReduxFramework/ReduxCore/framework.php' );
        require_once( WPESTATE_PLUGIN_PATH. '/ReduxFramework/loader.php' );
    }

    if ( !isset( $redux_demo ) && file_exists( dirname( __FILE__ ) . '/ReduxFramework/sample/sample-config.php' ) ) {
        require_once( WPESTATE_PLUGIN_PATH. '/ReduxFramework/admin-config.php' );

    }

In theme files i can access the the global $opt_name and everything works fine

After that i have created a functionality plugin. In this plugin i cannot access $opt_name , probably because the reduxframework is not initialized yet.

I read here Redux Framework not working when used in plugin that i should use Redux::init('opt_name') inside my plugin. However is not clear how since the class Redux is not existing yet.

Should i use it in after_setup_theme hook ? What will be the best way ? Thank you

1

1 Answers

0
votes

Simple answer, delay your accessing until the init hook has run, OR...

Redux::init('opt_name');

That will tell Redux to load your panel immediately. I do warn you, however, if you want to add to your panel anywhere except your loader.php, you'll be out of luck. Once the panel loads, it's loaded. You can't add more. ;)