I’m creating a wordpress theme in which I’m using the Redux Framework for creating the theme’s options page. Now I believe everything is well set up but I’m having trouble in getting the values changed by Redux in my front end.

For example I checked one of the checkbox in the settings panel had this attribute: name=”redux_demo[10]”, so in my front end I did this:

    <?php 
    if(get_option('redux_demo[10]')) { ?>  

      <h1>Text</h1>  

    <?php 
    }?>

But Text is not showing whether I save it as checked or unchecked. I also tried the following but it’s also not working:

    <?php 
    if(get_option('redux_demo[10]') === 1) { ?>

      <h1>Text</h1>  

    <?php 
    }?>

I searched a lot in the docs and also on the internet but I can’t find any tutorial that shows how to actually retrieve data saved by redux. Please let me know if you have any idea about this.

Thank you very much.

2 Answers
2

I have no idea how the framework actually stores its options, but I guess it uses the name redux_demo, not redux_demo[10]. If the option is an array, you can access the element 10 like this:

$redux_demo = get_option( 'redux_demo' );

if ( ! empty ( $redux_demo[ 10 ] ) and 1 === $redux_demo[ 10 ] )
{
    print '<h1>Text</h1>';
}

Leave a Reply

Your email address will not be published. Required fields are marked *