get_setting in wp_customise
-
I’m trying to create a setting that allows users to change the layout of a page.
I have other settings working just fine, but I just cannot for the life of me figure this one out, and the codex is of little to no help with it.
So, adding a new section, control etc.
$wp_customize->add_setting(‘layout’, array(
'default' => 'stream', )); $wp_customize->add_control('layout', array( 'label' => __('Select layout', 'Ari'), 'section' => 'layout', 'settings' => 'layout', 'type' => 'radio', 'choices' => array( 'stream' => 'Stream', 'grid' => 'Grid', ), )); // two options, Stream and Grid. $wp_customize->add_section('layout' , array( 'title' => __('Layout','Ari'), ));
Then I want to be able to display the loop with different html/markup/php based on the selected setting.
<?php if ( get_theme_mod( 'stream' ) ) : ?> <p>php/loop/layout for stream option</p> <?php elseif ( get_theme_mod( 'grid' ) ) : ?> <p>php/loop/layout for Grid option</p> <?php else : //Nothing ?> <?php endif; ?>
Except it displays nothing. How do I make an if/else statement for a particular setting?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘get_setting in wp_customise’ is closed to new replies.