Erstellen Sie eine Optionen-Seite mit zwei Bild-Upload-Feldern

Ich möchte eine einfache und saubere Optionsseite mit zwei Upload-Feldern und einer Vorschau der hochgeladenen Bilder erstellen. Ich habe viele Frameworks wie NHP und UpThemes ausprobiert, aber sie sind viel zu schwer für meinen Zweck (zB brauche ich nicht mehrere Optionen Tabs).

Ich habe das gefunden, was zu meinen Bedürfnissen passt, aber ich weiß nicht, wie ich ein zweites Upload-Feld hinzufügen kann. Jede Hilfe wäre willkommen!

 '' ); return $options; } function wptuts_options_init() { $wptuts_options = get_option( 'theme_wptuts_options' ); // Are our options saved in the DB? if ( false === $wptuts_options ) { // If not, we'll save our default options $wptuts_options = wptuts_get_default_options(); add_option( 'theme_wptuts_options', $wptuts_options ); } // In other case we don't need to update the DB } // Initialize Theme options add_action( 'after_setup_theme', 'wptuts_options_init' ); function wptuts_options_setup() { global $pagenow; if ('media-upload.php' == $pagenow || 'async-upload.php' == $pagenow) { // Now we'll replace the 'Insert into Post Button inside Thickbox' add_filter( 'gettext', 'replace_thickbox_text' , 1, 2 ); } } add_action( 'admin_init', 'wptuts_options_setup' ); function replace_thickbox_text($translated_text, $text ) { if ( 'Insert into Post' == $text ) { $referer = strpos( wp_get_referer(), 'wptuts-settings' ); if ( $referer != '' ) { return __('I want this to be my logo!', 'wptuts' ); } } return $translated_text; } // Add "Options" link to the "Appearance" menu function wptuts_menu_options() { //add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function); add_theme_page('WPTuts Options', 'Options', 'edit_theme_options', 'wptuts-settings', 'wptuts_admin_options_page'); } // Load the Admin Options page add_action('admin_menu', 'wptuts_menu_options'); function wptuts_admin_options_page() { ?> 

<input name="theme_wptuts_options[submit]" id="submit_options_form" type="submit" class="button-primary" value="" /> <input name="theme_wptuts_options[reset]" type="submit" class="button-secondary" value="" />

get_results($query); // And delete them (if more than one attachment is in the Library foreach ( $results as $row ) { wp_delete_attachment( $row -> ID ); } } // JavaScript function wptuts_options_enqueue_scripts() { wp_register_script( 'wptuts-upload', get_template_directory_uri() .'/wptuts-options/js/wptuts-upload.js', array('jquery','media-upload','thickbox') ); if ( 'appearance_page_wptuts-settings' == get_current_screen() -> id ) { wp_enqueue_script('jquery'); wp_enqueue_script('thickbox'); wp_enqueue_style('thickbox'); wp_enqueue_script('media-upload'); wp_enqueue_script('wptuts-upload'); } } add_action('admin_enqueue_scripts', 'wptuts_options_enqueue_scripts'); function wptuts_options_settings_init() { register_setting( 'theme_wptuts_options', 'theme_wptuts_options', 'wptuts_options_validate' ); // Add a form section for the Logo add_settings_section('wptuts_settings_header', __( 'Logo Options', 'wptuts' ), 'wptuts_settings_header_text', 'wptuts'); // Add Logo uploader add_settings_field('wptuts_setting_logo', __( 'Logo', 'wptuts' ), 'wptuts_setting_logo', 'wptuts', 'wptuts_settings_header'); // Add Current Image Preview add_settings_field('wptuts_setting_logo_preview', __( 'Logo Preview', 'wptuts' ), 'wptuts_setting_logo_preview', 'wptuts', 'wptuts_settings_header'); } add_action( 'admin_init', 'wptuts_options_settings_init' ); function wptuts_setting_logo_preview() { $wptuts_options = get_option( 'theme_wptuts_options' ); ?>
<img style="max-width:100%;" src="https://wordpress.stackexchange.com/questions/72129/create-an-options-page-with-two-image-upload-fields/" />

<input type="hidden" id="logo_url" name="theme_wptuts_options[logo]" value="https://wordpress.stackexchange.com/questions/72129/create-an-options-page-with-two-image-upload-fields/" /> <input id="upload_logo_button" type="button" class="button" value="" /> <input id="delete_logo_button" name="theme_wptuts_options[delete_logo]" type="submit" class="button" value="" />

Solutions Collecting From Web of "Erstellen Sie eine Optionen-Seite mit zwei Bild-Upload-Feldern"