Advertisement
pixeline

Additional wordpress theme options page.

Feb 20th, 2012
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.46 KB | None | 0 0
  1. <?php
  2.  
  3. add_action( 'admin_init', 'DWM_theme_options_init' );
  4. add_action( 'admin_menu', 'DWM_theme_options_add_page' );
  5.  
  6. function DWM_theme_options_init(){
  7.     register_setting( 'DWM_theme_options', 'DWM_theme_options');
  8. }
  9.  
  10. function DWM_theme_options_add_page() {
  11.     add_theme_page( __( 'DWM Theme Options', 'dwmtheme' ), __( 'DWM Theme Options', 'dwmtheme' ), 'edit_theme_options', 'theme_options', 'DWM_theme_options_do_page' );
  12. }
  13.  
  14. function DWM_theme_options_do_page() {
  15.     global $select_options;
  16.     if ( ! isset( $_REQUEST['settings-updated'] ) ) $_REQUEST['settings-updated'] = false;
  17.    
  18.    
  19.     // OPTION PAGE HEADER
  20.     ?>
  21.     <div>
  22. <?php screen_icon(); echo "<h2>". __( 'Custom Theme Options', 'dwmtheme' ) . "</h2>"; ?>
  23. <?php if ( false !== $_REQUEST['settings-updated'] ) : ?>
  24. <div>
  25. <p><strong><?php _e( 'Options saved', 'dwmtheme' ); ?></strong></p></div>
  26. <?php endif;
  27.  // END OPTION PAGE HEADER
  28. ?>
  29.    
  30.     <form method="post" action="options.php">
  31. <?php
  32.  
  33.     settings_fields( 'DWM_theme_options' );
  34.     $options = get_option( 'DWM_theme_options' );
  35.    
  36.     ?>
  37.     <tr valign="top"><th scope="row">
  38. <?php _e( 'Additional Header info', 'dwmtheme' ); ?></th>
  39. <td>
  40. <input id="DWM_theme_options[additionalheaderinfo]" name="DWM_theme_options[additionalheaderinfo]" type="checkbox" value="1"
  41. <?php checked( '1', $options['additionalheaderinfo'] ); ?>
  42. </td>
  43. </tr>
  44. <p>
  45. <input type="submit" value="<?php _e( 'Save Options', 'dwmtheme' ); ?>" />
  46. </p>
  47. </form>
  48. </div>
  49.     <?php
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement