KJ Prince KJ Prince - 1 year ago 59
PHP Question

How to Initiate Custom Redux Framework Config File

I'm just getting started with PHP and I'm trying to use the Redux Framework to build a theme settings panel.

I've successfully installed the plugin on my local dev environment, running WP Multi-site, and activated the demo.

Now I want to copy the sample-config.php file and build out my own configuration. However, I can't seem to initialize the copied file.

The docs say that all I have to do is copy the sample config to a "a new location" and then require that file like so:

require_once (dirname(__FILE__) . '/sample/sample-config.php'

So I made a copy and moved it up to the root directory of the Redux Plugin like so:


I'm not sure where I'm supposed to add the
require_once statement
. I've read the docs but they sort of glazed over this. I tried adding it to my
file, that doesn't work.

require_once WP_PLUGIN_DIR . '/redux-framework/my-custom-config.php';

Can someone please clarify where I should place the copied
file and where I should place the

Answer Source

lead dev at Redux here. For support questions our issue tracker is quite responsive. You may wan to try there next time: https://github.com/ReduxFramework/redux-framework/issues

Also if you REALLY want to save yourself time, you should use the Redux Builder. It will give you all you need: http://build.reduxframework.com

Are you trying to load this in a plugin or a theme?

If you're in a theme, you need but run the require_once in your functions.php file. Again, the builder will spit that out for you.

If you're running it in a plugin, you want to do the following:

function init_my_custom_redux() {
add_action('plugins_loaded', 'init_my_custom_redux', 30);

What this does is not load the config (within a plugin only) before the ReduxFramework plugin.

Either way, I hope that helps. Have a great day.