0

I have installed the redux option framework into my theme and made it work so things change when I add the sample config file. (and when I do print_r($redux_demo); in functions.php I get a wall of text at the top)

Problem I have is that I want to make it work in my theme. So I bought two other theme that use redux (seashell by meks and total by WPExplorer) to get some knowledge how to implement it but I just don't get it :(

I'm newbie to php and I wonder of you guys could explain how to do this with redux?

<?php if (something): ?>
<h1>It Works!!!</h1> <?php endif; ?>

I see that Seashell template do something like this:

<?php if($favicon = shl_get_option('favicon')): ?>
    <link rel="shortcut icon" href="<?php echo $favicon;?>" type="image/x-icon" />
<?php endif; ?>

So I want to just link the if statement to the "demo switch" (ID: switch-on) and make it work.

<?php if ($redux_demo('switch-on')): ?>
        <h1>It Works!!!</h1>
<?php endif; ?>

How do you do this? :)

Milap
  • 6,096
  • 8
  • 21
  • 44

1 Answers1

1

Just saw this question, I'm surprised it had no answer.

<?php if (true == $redux_demo('switch-on')): ?>
    <h1>It Works!!!</h1>
<?php endif; ?>

(note the use of Yoda conditions as well, which avoids accidentally introducing a tricky bug if you mistype an == as =)

Imperative
  • 654
  • 8
  • 17
  • you need to use brackets, not parenthesis. $redux_demo('switch-on') change it with $redux_demo['switch-on'] – ShahePars Oct 21 '17 at 12:56