WordPress.org

Make WordPress Core

Ticket #12186: restore-original.diff

File restore-original.diff, 1.2 KB (added by lancewillett, 4 years ago)

Add option to restore original background image

  • custom-background.php

     
    8787 
    8888                check_admin_referer('custom-background'); 
    8989 
    90                 // @TODO: No UI entry point for this: 
    9190                if ( isset($_POST['reset-background']) ) { 
    9291                        remove_theme_mods(); 
    9392                        return; 
     
    188187</tr> 
    189188<?php endif; ?> 
    190189 
     190<?php if ( defined( 'BACKGROUND_IMAGE' ) ) : // Show only if a default background image exists ?> 
    191191<tr valign="top"> 
     192<th scope="row"><?php _e('Restore Original Image'); ?></th> 
     193<td><p><?php _e('This will restore the original background image. You will not be able to restore any customizations.') ?></p> 
     194<form method="post" action=""> 
     195<?php wp_nonce_field('custom-background'); ?> 
     196<input type="submit" class="button" name="reset-background" value="<?php esc_attr_e('Restore Original Image'); ?>" /> 
     197</form> 
     198</td> 
     199</tr> 
     200</form> 
     201<?php endif; ?> 
     202<tr valign="top"> 
    192203<th scope="row"><?php _e('Upload Image'); ?></th> 
    193204<td><form enctype="multipart/form-data" id="uploadForm" method="POST" action=""> 
    194205<label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" />