/** * Process our Ajax request to remove the header image * */ function childtheme_remove_header_image_callback() { $nonce = $_REQUEST['_nonce']; if (!wp_verify_nonce($nonce, 'my-nonce')) { die('Nice Try'); } if (!childtheme_can_edit_theme_options()) { die('Nice Try'); } global $wpdb; // this is how you get access to the database $delete = delete_option($_REQUEST['field']); if ($delete == true) { _e("Image Removed"); } else { _e("Error"); } die; }
/** * Set up admin panel * */ function childtheme_admin() { if (!childtheme_can_edit_theme_options()) { wp_die('Nice Try'); } global $my_themename, $my_shortname, $my_options; if ($_REQUEST['saved']) { echo '<div id="message" class="updated fade"><p><strong>' . $my_themename . ' ' . __('settings saved.', 'thematic') . '</strong></p></div>'; } if ($_REQUEST['reset']) { echo '<div id="message" class="updated fade"><p><strong>' . $my_themename . ' ' . __('settings reset.', 'thematic') . '</strong></p></div>'; } if ($_REQUEST['reset_widgets']) { echo '<div id="message" class="updated fade"><p><strong>' . $my_themename . ' ' . __('widgets reset.', 'thematic') . '</strong></p></div>'; } if ($_REQUEST['error']) { echo '<div id="message" class="updated fade"><p><strong>The file you submitted was not a valid image type.</strong></p></div>'; } if ($_REQUEST['imgremoved']) { echo '<div id="message" class="updated fade"><p><strong>' . __('Image Removed') . '</strong></p></div>'; } ?> <div id="panel" class="wrap"> <div id="childtheme_theme_icon_32" class="icon32"></div> <h2><?php print $my_themename; ?> </h2> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?> " enctype="multipart/form-data"> <table class="form-table"> <tbody> <?php childtheme_admin_get_my_options(); ?> </tbody> </table> <p class="submit"> <input id='childoption_submit' name="save" type="submit" value="<?php _e('Save changes', 'thematic'); ?> " /> <input type="hidden" name="action" value="save" /> </p> </form> <form method="post" action=""> <p class="submit"> <input name="reset" type="submit" value="<?php _e('Reset', 'thematic'); ?> " /> <input type="hidden" name="action" value="reset" /> </p> </form> <!-- <form method="post" action=""> <p class="submit"> <input name="reset_widgets" type="submit" value="<?php _e('Reset Widgets', 'thematic'); ?> " /> <input type="hidden" name="action" value="reset_widgets" /> </p> </form> --> </div> <?php }