So I'm trying to build a conditional statement to display different layouts depending on the option selected.
Having a bit of trouble.
$wp_customize->add_setting('layout', array(
'default' => 'stream',
)); // add our default setting.
$wp_customize->add_control('layout', array(
'label' => __('Select layout', 'Ari'),
'section' => 'layout',
'settings' => 'layout',
'type' => 'radio',
'choices' => array(
'stream' => 'Stream',
'grid' => 'Grid',
),
)); // use radio buttons with (so far) two choices.
So here we have a couple of choices.
$wp_customize->add_section('layout' , array(
'title' => __('Layout','Ari'),
)); // add our layout section in the customize panel.
Displaying our layout.
<?php if ( get_theme_mod( 'stream' ) ) : ?>
<p>stream</p> if ( have_posts() ) etc
<?php elseif ( get_theme_mod( 'grid' ) ) : ?>
<p>grid</p> // if ( have_posts() ) etc
<?php else : //Nothing ?>
<?php endif; ?>
Just...nothing. I've trawled through the codex and I can't see what I'm doing wrong. It just doesn't show any output.
What about get_setting? How would I write a conditional for that?