• Hey, I need some help, if someone would be nice enough to do so that would be great! Thanks in advance.

    My problem is, I’m working on a custom options page for a theme I’m making for a client. I’m not really sure how to explain my problem but I’ll try my best. I’m trying to make a select with different color options to change the color of a h1 tag on the homepage. My code is below if anyone can look at it and see if they can figure out how to get it to work.

    <?php settings_fields( 'ss-settings-group' ); ?>
        <table class="form-table">
        <h2>Headlines</h2>
            <tr valign="top">
            <th scope="row"><strong>Headline One</strong><br />
            <small>This is the large red headline visible on top of the homepage.</small></th>
            <td><textarea name="headline_one" cols="40" rows="4"><?php echo get_option('headline_one'); ?></textarea></td>
            </tr>
    
            <tr valign="top">
            <th scope="row"><strong>Headline Two</strong><br />
            <small>This is the medium black headline visible on the homepage.</small></th>
            <td><textarea name="headline_two" cols="40" rows="4"><?php echo get_option('headline_two'); ?></textarea></td>
            </tr>
    
            <tr valign="top">
            <th scope="row"><strong>Headline One Color</strong></th>
            <td><select name="h1_color">
            		<option value="Red">Red</option>
            		<option value="Blue">Blue</option>
            		<option value="Green">Green</option>
            		<option value="Orange">Orange</option>
            		<option value="Yellow">Yellow</option>
            		<option value="Teal">Teal</option>
                </select>
            </tr>
    
            <tr valign="top">
            <th scope="row"><strong>Headline Two Color</strong></th>
            <td><select name="h2_color">
            		<option value="red">Red</option>
            		<option value="blue">Blue</option>
            		<option value="green">Green</option>
            		<option value="orange">Orange</option>
            		<option value="yellow">Yellow</option>
            		<option value="teal">Teal</option>
                </select>
            </tr>
        </table>
    
        <table class="form-table">
        <h2>Video Embed</h2>
            <tr valign="top">
            <th scope="row"><strong>Video Code</strong><br />
            <small>Place your videos embed code in the box to the right and it will appear on the homepage.</small></th>
            <td><textarea name="video_code" cols="40" rows="4"><?php echo get_option('video_code'); ?></textarea></td>
            </tr>
        </table>
    
        <table class="form-table">
        <h2>Aweber Form</h2>
            <tr valign="top">
            <th scope="row"><strong>Aweber Form ID</strong><br />
            <small>This is the 9 digit number in your aweber Raw HTML Version code.</th>
            <td><input name="aweber_formid" style="margin-top: 15px; width: 200px;" type="text" value="<?php echo get_option('aweber_formid'); ?>" /></td>
            </tr>
    
            <tr valign="top">
            <th scope="row"><strong>Aweber Username</strong><br />
            <small>Enter your username for Aweber in the box to the right.</small></th>
            <td><input name="aweber_listname" style="margin-top: 15px; width: 200px;" type="text" value="<?php echo get_option('aweber_listname'); ?>" /></td>
            </tr>
        </table>
    
        <table class="form-table">
        <h2>Footer Text</h2>
            <tr valign="top">
            <th scope="row"><strong>Copyright Text</strong><br />
            <small>This is your copyright text which is centered to the bottom of the page, above the disclaimer.</small></th>
            <td><textarea name="copy_text" cols="40" rows="4"><?php echo get_option('copy_text'); ?></textarea></td>
            </tr>
    
            <tr valign="top">
            <th scope="row"><strong>Disclaimer Text</strong><br />
            <small>Enter the disclaimer for your product or service here.</small></th>
            <td><textarea name="disclaimer_text" cols="40" rows="4"><?php echo get_option('disclaimer_text'); ?></textarea></td>
            </tr>
        </table>
    
        <table class="form-table">
        <h2>Google Analytics</h2>
            <tr valign="top">
            <th scope="row"><strong>Google Analytics Code</strong><br />
            <small>Enter your Google Analytics code in the box on the right.</th>
            <td><textarea name="ga_code" cols="40" rows="4"><?php echo get_option('ga_code'); ?></textarea></td>
            </tr>
        </table>
    
        <p class="submit">
        <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
        </p>
    
    </form>
    </div>
    <?php } ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter wphax

    (@wphax)

    Anyone? ??

    Thread Starter wphax

    (@wphax)

    Figured it out, had to set up my options like this:

    <?php $h2_color = get_option('h2_color'); ?>
    <option value="red" <?php if($h2_color == "red") { echo "selected='selected'"; } ?>>Red</option>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Need Help using select tag in my custom options page’ is closed to new replies.