Ejemplo n.º 1
0
/**
 * Create the options page
 */
function cleanhome_theme_options_do_page()
{
    if (!isset($_REQUEST['settings-updated'])) {
        $_REQUEST['settings-updated'] = false;
    }
    ?>
	<div class="wrap">
		<?php 
    screen_icon();
    echo "<h2>" . get_current_theme() . ' ' . __('Theme Options', 'cleanhome') . "</h2>";
    ?>

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

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

			<table class="form-table">

				<?php 
    /**
     * Clean Home Color Scheme
     */
    ?>
				<tr valign="top" class="image-radio-option color-scheme"><th scope="row"><?php 
    _e('Color Schemes', 'cleanhome');
    ?>
</th>
					<td>
						<fieldset><legend class="screen-reader-text"><span><?php 
    _e('Color Schemes', 'cleanhome');
    ?>
</span></legend>
						<?php 
    if (!isset($checked)) {
        $checked = '';
    }
    foreach (cleanhome_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="cleanhome_theme_options[color_scheme]" value="<?php 
        echo esc_attr($option['value']);
        ?>
" <?php 
        echo $checked;
        ?>
 /> <?php 
        echo $option['label'];
        ?>
									<span>
										<img src="<?php 
        echo get_template_directory_uri() . '/images/color-' . esc_attr($option['value']) . '.png';
        ?>
" width="200" height="147" alt="" />
									</span>
								</label>
								</div>
								<?php 
    }
    ?>
						</fieldset>
					</td>
				</tr>
			</table>

			<p class="submit">
				<input type="submit" class="button-primary" value="<?php 
    esc_attr_e('Save Options', 'cleanhome');
    ?>
" />
			</p>
		</form>
	</div>
	<?php 
}
Ejemplo n.º 2
0
function cleanhome_color_registrar()
{
    $options = cleanhome_get_theme_options();
    $color_scheme = $options['color_scheme'];
    if ('dark' == $color_scheme) {
        wp_register_style('dark', get_template_directory_uri() . '/colors/dark.css', null, null);
        wp_enqueue_style('dark');
    }
    if ('snowy' == $color_scheme) {
        wp_register_style('snowy', get_template_directory_uri() . '/colors/snowy.css', null, null);
        wp_enqueue_style('snowy');
    }
    if ('sunny' == $color_scheme) {
        wp_register_style('sunny', get_template_directory_uri() . '/colors/sunny.css', null, null);
        wp_enqueue_style('sunny');
    }
}