Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'admin_init', 'theme_options_init' );
- add_action( 'admin_menu', 'theme_options_add_page' );
- add_action( 'admin_enqueue_scripts', 'mw_enqueue_color_picker' );
- function mw_enqueue_color_picker( $hook_suffix ) {
- // first check that $hook_suffix is appropriate for your admin page
- wp_enqueue_style( 'wp-color-picker' );
- wp_enqueue_script( 'my-script-handle', plugins_url('my-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
- }
- // Einstellungen registrieren (http://codex.wordpress.org/Function_Reference/register_setting)
- function theme_options_init(){
- register_setting( 'kb_options', 'kb_theme_options', 'kb_validate_options' );
- }
- // Seite in der Dashboard-Navigation erstellen
- function theme_options_add_page() {
- add_theme_page('Configuração', 'Configuração', 'edit_theme_options', 'theme-optionen', 'kb_theme_options_page' );
- }
- // Optionen-Seite erstellen
- function kb_theme_options_page() {
- global $select_options, $radio_options;
- if ( ! isset( $_REQUEST['settings-updated'] ) )
- $_REQUEST['settings-updated'] = false;
- echo $_FILES['datei']['name'] ;
- ?>
- <div class="wrap">
- <?php screen_icon(); ?><h2>Configuração</h2>
- <?php if ( false !== $_REQUEST['settings-updated'] ) : ?>
- <div class="updated fade">
- <p><strong>Configuração salva!</strong></p>
- </div>
- <?php endif; ?>
- <form method="post" action="options.php" enctype="multipart/form-data">
- <?php settings_fields( 'kb_options' ); ?>
- <?php $options = get_option( 'kb_theme_options' ); ?>
- <h3>Banner</h3>
- <table class="form-table">
- <tr valign="top">
- <th scope="row">Banner</th>
- <td><input type="file" name="datei"></td>
- </tr>
- </table>
- <!-- submit -->
- <p class="submit"><input type="submit" class="button-primary" value="Salvar configuração e subir imagens" /></p>
- </form>
- </div>
- <?php }
- // Strip HTML-Code:
- // Hier kann definiert werden, ob HTML-Code in einem Eingabefeld
- // automatisch entfernt werden soll. Soll beispielsweise im
- // Copyright-Feld KEIN HTML-Code erlaubt werden, kommentiert die Zeile
- // unten wieder ein. http://codex.wordpress.org/Function_Reference/wp_filter_nohtml_kses
- function kb_validate_options( $input ) {
- // $input['copyright'] = wp_filter_nohtml_kses( $input['copyright'] );
- return $input;
- } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement