1

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:

/plugins/redux-framework/my-custom-config.php

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 functions.php 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 sample-config.php file and where I should place the require_once statement?

1
  • Its clear that I'm missing a concept here. The fact that the docs don't explicitly state where to create the custom config and where to include it tell me that I should just know. Could someone clue me in?
    – Ken Prince
    Commented May 29, 2014 at 15:56

1 Answer 1

4

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() {
    require_once(dirname(__FILE__).'/path/to/config.php');
}
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.

5
  • I'm building a theme. I used the builder but it generates an admin file for embedding, which I want to avoid (so I can get updates as I improve the theme over time). I'll be managing the theme for clients and so they won't need to enable it, so TGM is unnecessary for my application. I guess I was loading the config file before the redux plugin and needed to hook into plugins_loaded. I'm assuming I can copy the sample config file anywhere I want?
    – Ken Prince
    Commented May 29, 2014 at 17:22
  • 1
    Ok I tried copying the sample config file and including it in my functions.php using the snippet above. I can't seem to make it work. In fact, the demo is still active, but I can no longer deactivate it. The link in the plugins admin has disappeared. I'll figure this out and post back here.
    – Ken Prince
    Commented May 29, 2014 at 17:54
  • If you don't want to embed redux, then go to the TGM tab of the builder and select TGM only. This will only give you an admin folder with the config files. Redux will have to be installed via the WP directory. :)
    – Dovy
    Commented May 30, 2014 at 14:57
  • @Dovy Hi, What I am working on is pretty similar, I want to divide my redux custom config file into 2 parts, first file will be used by say plugin-A, and I want the rest of my custom config options to go in another plugin, say plugin-B. Is it possible to have 2 plugins carry 2 different config files for 1 redux installation? If so, how to implement this? Thanks! Awaiting your reply! Commented Jun 12, 2015 at 10:59
  • @Dovy In simple words, is it possible to have multiple config files in one installation of Redux plugin? If yes, how? Commented Jun 12, 2015 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.