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.
I have no idea how the framework actually stores its options, but I guess it uses the name
redux_demo
, notredux_demo[10]
. If the option is an array, you can access the element10
like this:Redux actually stores your saved settings in a global variable which is established in your redux config file (public function setArguements) under opt_name, in this case $redux_demo. You can choose which option you want to display by referencing the unique ID of that option. Here’s an example:
Hope that helps!