Redux WP Framework. A simple working code example?

6.1k Views Asked by At

Can anyone who successfully used this framework help me? Redux states that it utilizes a global variable for referencing all of the saved options in the database.

My goal is to access these stored options, so I can figure out how to call them.

Admittedly, I am new to using options panel frameworks. There is another similar question at: redux framework wordpress calling variable. I can't figure out using the documentation how this is done.

Here is the documentation for the framework: http://plovs.github.io/Redux-Framework-Docs/docs.html

What am I missing? The section/field arrays look like this:

    $sections[] = array(
    'title' => __('Home Settings', 'redux-framework-demo'),
    'desc' => __('Here, you can change any of the many options bundled with samTheme', 'redux-framework-demo'),
    'icon' => 'el-icon-home',
    // 'submenu' => false, // Setting submenu to false on a given section will hide it from the WordPress sidebar menu!
    'fields' => array(  
        array(
            'id'=>'webFonts',
            'type' => 'media', 
            'title' => __('Web Fonts', 'redux-framework-demo'),
            'compiler' => 'true',
            'mode' => false, // Can be set to false to allow any media type, or can also be set to any mime type.
            'desc'=> __('Basic media uploader with disabled URL input field.', 'redux-framework-demo'),
            'subtitle' => __('Upload any media using the WordPress native uploader', 'redux-framework-demo'),
            ),              

The $sections[] array id is generic in name. The arrays are generic in name. I'm assuming these can be referenced by id? This is ultra confusing. If I'm missing something ridiculous here, I apologise in advance. I'm completely new to this framework.

3

There are 3 best solutions below

2
On BEST ANSWER

I too found Redux Framework confusing at first.

I think what you're trying to do (assuming this is still the case, as it's an old question) is output the value of the Redux Framework opt_name variable.

Find the value of opt_name in your options/config file. Using the sample config file as an example, opt_name is defined as redux_demo.

So armed with that, head over to your functions.php page (or any of your theme's pages as an example) and declare

global $redux_demo;

followed by

echo $redux_demo['webFonts']['url'];

That should output the URL saved within the webFonts section of your options panel. You can find a list of available fields along with more example code at http://docs.reduxframework.com/core/fields/media/

1
On

Spoiler alert, I am a core dev of Redux, ha.

So the best place to get support is our issue tracker found here: https://github.com/ReduxFramework/ReduxFramework/issues

But, I'll answer this here.

The docs you have are old, really old, like 2 years old. Redux is a completely new setup now. Please look here: https://github.com/ReduxFramework/ReduxFramework/wiki/Getting-Started#step-3-using-the-saved-option-values

That should answer all your questions. Let me know if you need further help!

0
On

In Config file find:

$opt_name = 'your_opt_name';

In functions.php or in theme:

global $your_opt_name;

echo $your_opt_name['webFonts'];

Or you can debug to get full info:

var_dump($your_opt_name)