WordPress.org

Make WordPress Core

Changeset 14209


Ignore:
Timestamp:
04/23/2010 10:10:21 PM (8 years ago)
Author:
nacin
Message:

Custom background UI tweaks. Props TECannon. see #12186, fixes #12699

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/custom-background.php

    r14070 r14209  
    144144<p><?php printf(__('Background updated. <a href="%s">Visit your site</a> to see how it looks.'), home_url()); ?></p>
    145145</div>
    146 <?php } ?>
    147 <p><?php _e('This is your current background.'); ?></p>
    148 <?php
     146<?php }
     147
    149148    if ( $this->admin_image_div_callback ) {
    150149        call_user_func($this->admin_image_div_callback);
    151150    } else {
    152151?>
    153 
     152<h3><?php _e('Background Image'); ?></h3>
     153<table class="form-table">
     154<tbody>
     155<tr valign="top">
     156<th scope="row"><?php _e('Current Image'); ?></th>
     157<td>
    154158<style type="text/css">
    155159#custom-background-image {
     
    171175</div>
    172176<?php } ?>
    173 <h3><?php _e('Change Display Options') ?></h3>
     177</td>
     178</tr>
     179<?php if ( get_background_image() ) : ?>
     180<tr valign="top">
     181<th scope="row"><?php _e('Remove Image'); ?></th>
     182<td><p><?php _e('This will remove the background image. You will not be able to restore any customizations.') ?></p>
    174183<form method="post" action="">
    175 <table>
    176 <thead>
    177 <tr>
    178 <th scope="col"><?php _e( 'Position' ); ?></th>
    179 <th scope="col"><?php _e( 'Repeat' ); ?></th>
    180 <th scope="col"><?php _e( 'Attachment' ); ?></th>
    181 <th scope="col"><?php _e( 'Color' ); ?></th>
    182 </tr>
    183 
    184 <tbody>
    185 <tr>
    186 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Position' ); ?></span></legend>
    187 <label>
    188 <input name="background-position" type="radio" value="left" <?php checked('left', get_theme_mod('background_position', 'left')); ?> />
    189 <?php _e('Left') ?>
    190 </label>
    191 <label>
    192 <input name="background-position" type="radio" value="center" <?php checked('center', get_theme_mod('background_position', 'left')); ?> />
    193 <?php _e('Center') ?>
    194 </label>
    195 <label>
    196 <input name="background-position" type="radio" value="right" <?php checked('right', get_theme_mod('background_position', 'left')); ?> />
    197 <?php _e('Right') ?>
    198 </label>
    199 </fieldset></td>
    200 
    201 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Repeat' ); ?></span></legend>
    202 <label>
    203 <select name="background-repeat">
    204     <option value="no-repeat" <?php selected('no-repeat', get_theme_mod('background_repeat', 'repeat')); ?> ><?php _e('No repeat'); ?></option>
    205     <option value="repeat" <?php selected('repeat', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile'); ?></option>
    206     <option value="repeat-x" <?php selected('repeat-x', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile Horizontally'); ?></option>
    207     <option value="repeat-y" <?php selected('repeat-y', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile Vertically'); ?></option>
    208 </select>
    209 </label>
    210 </fieldset></td>
    211 
    212 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Attachment' ); ?></span></legend>
    213 <label>
    214 <input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', 'fixed')); ?> />
    215 <?php _e('Scroll') ?>
    216 </label>
    217 <label>
    218 <input name="background-attachment" type="radio" value="fixed" <?php checked('fixed', get_theme_mod('background_attachment', 'fixed')); ?> />
    219 <?php _e('Fixed') ?>
    220 </label>
    221 </fieldset></td>
    222 
    223 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Color' ); ?></span></legend>
    224 <input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr(get_background_color()) ?>" />
    225 <input type="button" class="button" value="<?php esc_attr_e('Select a Color'); ?>" id="pickcolor" />
    226 
    227 <div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div>
    228 </fieldset></td>
    229 </tr>
    230 </tbody>
    231 </table>
    232 
    233184<?php wp_nonce_field('custom-background'); ?>
    234 <p class="submit"><input type="submit" class="button" name="save-background-options" value="<?php esc_attr_e('Save Changes'); ?>" /></p>
     185<input type="submit" class="button" name="remove-background" value="<?php esc_attr_e('Remove Background'); ?>" />
    235186</form>
    236 
    237 <h3><?php _e('Upload New Background Image'); ?></h3>
    238 <form enctype="multipart/form-data" id="uploadForm" method="POST" action="">
     187</td>
     188</tr>
     189<?php endif; ?>
     190
     191<tr valign="top">
     192<th scope="row"><?php _e('Upload Image'); ?></th>
     193<td><form enctype="multipart/form-data" id="uploadForm" method="POST" action="">
    239194<label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" />
    240195<input type="hidden" name="action" value="save" />
     
    244199</p>
    245200</form>
    246 
    247 <?php if ( get_background_image() ) : ?>
    248 <h3><?php _e('Remove Background Image'); ?></h3>
    249 <p><?php _e('This will remove the background image. You will not be able to restore any customizations.') ?></p>
     201</td>
     202</tbody>
     203</table>
     204
     205<h3><?php _e('Display Options') ?></h3>
    250206<form method="post" action="">
     207<table class="form-table">
     208<tbody>
     209<tr valign="top">
     210<th scope="row"><?php _e( 'Background Color' ); ?></th>
     211<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend>
     212<input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr(get_background_color()) ?>" />
     213<input type="button" class="button" value="<?php esc_attr_e('Select a Color'); ?>" id="pickcolor" />
     214
     215<div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div>
     216</fieldset></td>
     217</tr>
     218
     219<tr valign="top">
     220<th scope="row"><?php _e( 'Background Position' ); ?></th>
     221<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend>
     222<label>
     223<input name="background-position" type="radio" value="left" <?php checked('left', get_theme_mod('background_position', 'left')); ?> />
     224<?php _e('Left') ?>
     225</label>
     226<label>
     227<input name="background-position" type="radio" value="center" <?php checked('center', get_theme_mod('background_position', 'left')); ?> />
     228<?php _e('Center') ?>
     229</label>
     230<label>
     231<input name="background-position" type="radio" value="right" <?php checked('right', get_theme_mod('background_position', 'left')); ?> />
     232<?php _e('Right') ?>
     233</label>
     234</fieldset></td>
     235</tr>
     236
     237<tr valign="top">
     238<th scope="row"><?php _e( 'Repeat' ); ?></th>
     239<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Repeat' ); ?></span></legend>
     240<label>
     241<select name="background-repeat">
     242    <option value="no-repeat" <?php selected('no-repeat', get_theme_mod('background_repeat', 'repeat')); ?> ><?php _e('No repeat'); ?></option>
     243    <option value="repeat" <?php selected('repeat', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile'); ?></option>
     244    <option value="repeat-x" <?php selected('repeat-x', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile Horizontally'); ?></option>
     245    <option value="repeat-y" <?php selected('repeat-y', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile Vertically'); ?></option>
     246</select>
     247</label>
     248</fieldset></td>
     249</tr>
     250
     251<tr valign="top">
     252<th scope="row"><?php _e( 'Attachment' ); ?></th>
     253<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Attachment' ); ?></span></legend>
     254<label>
     255<input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', 'fixed')); ?> />
     256<?php _e('Scroll') ?>
     257</label>
     258<label>
     259<input name="background-attachment" type="radio" value="fixed" <?php checked('fixed', get_theme_mod('background_attachment', 'fixed')); ?> />
     260<?php _e('Fixed') ?>
     261</label>
     262</fieldset></td>
     263</tr>
     264
     265</tbody>
     266</table>
     267
    251268<?php wp_nonce_field('custom-background'); ?>
    252 <input type="submit" class="button" name="remove-background" value="<?php esc_attr_e('Remove Background'); ?>" />
     269<p class="submit"><input type="submit" class="button-primary" name="save-background-options" value="<?php esc_attr_e('Save Changes'); ?>" /></p>
    253270</form>
    254 <?php endif; ?>
    255271
    256272</div>
Note: See TracChangeset for help on using the changeset viewer.