コード例 #1
0
/**
 *  Returns the current floral scheme as selected in the theme options
 */
function bouquet_current_floral_scheme()
{
    $options = bouquet_get_options();
    return $options['color_scheme'];
}
コード例 #2
0
function bouquet_theme_options_do_page()
{
    if (!isset($_REQUEST['settings-updated'])) {
        $_REQUEST['settings-updated'] = false;
    }
    ?>
	<div class="wrap">
		<?php 
    $theme_name = wp_get_theme();
    ?>
		<?php 
    screen_icon();
    echo "<h2>" . $theme_name . __(' Theme Options', 'bouquet') . "</h2>";
    ?>

		<?php 
    if (false !== $_REQUEST['settings-updated']) {
        ?>
		<div class="updated fade"><p><strong><?php 
        _e('Options saved', 'bouquet');
        ?>
</strong></p></div>
		<?php 
    }
    ?>

		<form method="post" action="options.php">
			<?php 
    settings_fields('bouquet_options');
    ?>
			<?php 
    $options = bouquet_get_options();
    ?>

			<table class="form-table">

				<?php 
    // Bouquet Color Scheme
    ?>
				<tr valign="top" id="bouquet-colors"><th scope="row"><?php 
    _e('Color Scheme', 'bouquet');
    ?>
</th>
					<td>
						<fieldset><legend class="screen-reader-text"><span><?php 
    _e('Color Scheme', 'bouquet');
    ?>
</span></legend>
						<?php 
    if (!isset($checked)) {
        $checked = '';
    }
    foreach (bouquet_color_schemes() as $option) {
        $radio_setting = $options['color_scheme'];
        if ('' != $radio_setting) {
            if ($options['color_scheme'] == $option['value']) {
                $checked = "checked=\"checked\"";
            } else {
                $checked = '';
            }
        }
        ?>
								<div class="layout">
								<label class="description">
									<input type="radio" name="bouquet_theme_options[color_scheme]" value="<?php 
        echo esc_attr($option['value']);
        ?>
" <?php 
        echo $checked;
        ?>
 />
									<span>
										<img src="<?php 
        echo get_template_directory_uri();
        ?>
/colors/<?php 
        echo $option['value'];
        ?>
/<?php 
        echo $option['value'];
        ?>
.png"/>
										<?php 
        echo $option['label'];
        ?>
									</span>
								</label>
								</div>
								<?php 
    }
    ?>
						</fieldset>
					</td>
				</tr>
			</table>

			<p class="submit">
				<input type="submit" class="button-primary" value="<?php 
    esc_attr_e('Save Options', 'bouquet');
    ?>
" />
			</p>
		</form>
	</div>
	<?php 
}