I have a custom theme option that allows the changing of logos. There are 3 logo options: option1, option2, and option3.
Upon theme activation, the default "option1" logo appears, but above it I get a "Notice: Undefined index: flagship_sub_shield in...". This error goes away if I save my custom theme option page.
Is there something wrong with how I'm writing my conditional? Or is the issue probably more with the theme-options.php file?
My code in header.php is
<?php $theme_option = flagship_sub_get_global_options(); $shield = $theme_option['flagship_sub_shield']; if ('option2' === $shield): //Image Option #2 elseif ('option3' === $shield): //Image Option #3 else: //Image Option #1 endif; ?> The flagship_sub_get_global_options function is located in my theme-options.php file, in my library directory. The relevant option is:
$options[21] = array( 'section' => 'select_section', 'id' => FLAGSHIP_SUB_SHORTNAME . '_shield', 'title' => __( 'Shield', 'flagship_sub_textdomain' ), 'desc' => __( 'Which shield should appear in the header?', 'flagship_sub_textdomain' ), 'type' => 'select', 'choices' => array('option1','option2','option3'), 'std' => 'option1', ); Any help is appreciated!