Advertisement
Guest User

Untitled

a guest
Jan 21st, 2013
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. <?php
  2.  
  3. add_action( 'admin_init', 'theme_options_init' );
  4. add_action( 'admin_menu', 'theme_options_add_page' );
  5.  
  6. add_action( 'admin_enqueue_scripts', 'mw_enqueue_color_picker' );
  7. function mw_enqueue_color_picker( $hook_suffix ) {
  8. // first check that $hook_suffix is appropriate for your admin page
  9. wp_enqueue_style( 'wp-color-picker' );
  10. wp_enqueue_script( 'my-script-handle', plugins_url('my-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
  11. }
  12.  
  13. // Einstellungen registrieren (http://codex.wordpress.org/Function_Reference/register_setting)
  14. function theme_options_init(){
  15. register_setting( 'kb_options', 'kb_theme_options', 'kb_validate_options' );
  16. }
  17.  
  18. // Seite in der Dashboard-Navigation erstellen
  19. function theme_options_add_page() {
  20. add_theme_page('Configuração', 'Configuração', 'edit_theme_options', 'theme-optionen', 'kb_theme_options_page' );
  21. }
  22.  
  23. // Optionen-Seite erstellen
  24. function kb_theme_options_page() {
  25. global $select_options, $radio_options;
  26. if ( ! isset( $_REQUEST['settings-updated'] ) )
  27. $_REQUEST['settings-updated'] = false;
  28.  
  29.  
  30. echo $_FILES['datei']['name'] ;
  31.  
  32. ?>
  33.  
  34. <div class="wrap">
  35. <?php screen_icon(); ?><h2>Configuração</h2>
  36.  
  37. <?php if ( false !== $_REQUEST['settings-updated'] ) : ?>
  38. <div class="updated fade">
  39. <p><strong>Configuração salva!</strong></p>
  40. </div>
  41. <?php endif; ?>
  42. <form method="post" action="options.php" enctype="multipart/form-data">
  43. <?php settings_fields( 'kb_options' ); ?>
  44. <?php $options = get_option( 'kb_theme_options' ); ?>
  45.  
  46.  
  47.  
  48.  
  49. <h3>Banner</h3>
  50. <table class="form-table">
  51. <tr valign="top">
  52. <th scope="row">Banner</th>
  53. <td><input type="file" name="datei"></td>
  54. </tr>
  55.  
  56. </table>
  57.  
  58.  
  59.  
  60. <!-- submit -->
  61. <p class="submit"><input type="submit" class="button-primary" value="Salvar configuração e subir imagens" /></p>
  62. </form>
  63.  
  64. </div>
  65. <?php }
  66.  
  67. // Strip HTML-Code:
  68. // Hier kann definiert werden, ob HTML-Code in einem Eingabefeld
  69. // automatisch entfernt werden soll. Soll beispielsweise im
  70. // Copyright-Feld KEIN HTML-Code erlaubt werden, kommentiert die Zeile
  71. // unten wieder ein. http://codex.wordpress.org/Function_Reference/wp_filter_nohtml_kses
  72. function kb_validate_options( $input ) {
  73. // $input['copyright'] = wp_filter_nohtml_kses( $input['copyright'] );
  74. return $input;
  75. } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement