WordPress.org

Support

Support » Themes and Templates » Delete Option via Custom Menu

Delete Option via Custom Menu

  • I have a custom menu setup in the dashboard that allows a user to upload images for a slider.

    Here is my current code:

    add_action('admin_init', 'register_and_build_fields');
    function register_and_build_fields() {
    	register_setting('store_options', 'store_options', 'validate_setting');
    
            add_settings_section('slider_section', 'Slideshow Images', 'section_cb', 'number-4-studios');
    	add_settings_field('slider_image1', 'Image 1:', 'slider_image1_setting', 'number-4-studios', 'slider_section');
    }
    
    // Slider Image 1
    function slider_image1_setting() {
    	$options = get_option('store_options');
    	echo '<input type="file" name="slider1" size="50" class="slider" />';
    	if ($options['slider1'] != '') {
    		echo '<img src="' . $options['slider1'] . '" width="76px" height="50px" />';
    	} else {
    		echo '<img src="' . get_bloginfo('stylesheet_directory') . '/images/no-image.gif" />';
    	}
    }

    My question is… how can I add a delete button so a user can then delete that image?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Delete Option via Custom Menu’ is closed to new replies.