WordPress.org

Forums

Delete Option via Custom Menu (2 posts)

  1. w1nk5
    Member
    Posted 4 years ago #

    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?

  2. w1nk5
    Member
    Posted 4 years ago #

    bump

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.