Want more features on Pastebin? Sign Up, it's FREE!
Guest

navbar options panel

By: a guest on Aug 14th, 2010  |  syntax: None  |  size: 2.61 KB  |  views: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. // create custom plugin settings menu
  3. add_action('admin_menu', 'bp_wp_navbar_config');
  4.  
  5. function bp_wp_navbar_config() {
  6.  
  7. //create new settings menu
  8.         add_options_page('BP-WP-Navbar Options', 'BP-WP-Navbar', 'administrator', __FILE__, 'bp_wp_navbar_options',plugins_url('/images/icon.png', __FILE__));
  9.  
  10.  
  11.         //call register settings function
  12.         add_action( 'admin_init', 'bp_wp_navbar_settings' );
  13. }
  14.  
  15.  
  16. function bp_wp_navbar_settings() {
  17.         //register our settings
  18.         register_setting( 'bp_wp_navbar-settings-group', 'hide_main_nav' );
  19.         register_setting( 'bp_wp_navbar-settings-group', 'hide_site_name' );
  20.         register_setting( 'bp_wp_navbar-settings-group', 'hide_login_signup' );
  21.         register_setting( 'bp_wp_navbar-settings-group', 'hide_visit_random' );
  22. }
  23.  
  24. function bp_wp_navbar_options() {
  25. ?>
  26. <div class="wrap">
  27. <h2>BP-WP-Navbar Configuration Options</h2>
  28. <h4>Check the options you wish to enable/disable below</h4>
  29.  
  30. <form method="post" action="options.php">
  31.     <?php settings_fields( 'bp_wp_navbar-settings-group' ); ?>
  32.     <table class="form-table">
  33.         <tr valign="top">
  34.         <th scope="row">Hide Main Nav?</th>
  35.         <td>Yes&nbsp;<input type="radio" name="hide_main_nav" value="<?php echo get_option('hide_main_nav'); ?>" />&nbsp;&nbsp;&nbsp;&nbsp;No&nbsp;<input type="radio" name="hide_main_nav" value="<?php echo get_option('hide_main_nav'); ?>" /></td>
  36.         </tr>
  37.          
  38.         <tr valign="top">
  39.         <th scope="row">Hide Site Name?</th>
  40.         <td>Yes&nbsp;<input type="radio" name="hide_site_name" value="<?php echo get_option('hide_site_name'); ?>" />&nbsp;&nbsp;&nbsp;&nbsp;No&nbsp;<input type="radio" name="hide_site_name" value="<?php echo get_option('hide_site_name'); ?>" /></td>
  41.         </tr>
  42.        
  43.         <tr valign="top">
  44.         <th scope="row">Hide Login and Signup Links?</th>
  45.         <td>Yes&nbsp;<input type="radio" name="hide_login_signup" value="<?php echo get_option('hide_login_signup'); ?>" />&nbsp;&nbsp;&nbsp;&nbsp;No&nbsp;<input type="radio" name="hide_login_signup" value="<?php echo get_option('hide_login_signup'); ?>" /></td>
  46.         </tr>
  47.  
  48.         <tr valign="top">
  49.         <th scope="row">Hide Visit Random Menu?</th>
  50.         <td>Yes&nbsp;<input type="radio" name="hide_visit_random" value="<?php echo get_option('hide_visit_random'); ?>" />&nbsp;&nbsp;&nbsp;&nbsp;No&nbsp;<input type="radio" name="hide_visit_random" value="<?php echo get_option('hide_visit_random'); ?>" /></td>
  51.         </tr>
  52.     </table>
  53.    
  54.     <p class="submit">
  55.     <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
  56.     </p>
  57.  
  58. </form>
  59. </div>
  60. <?php } ?>
clone this paste RAW Paste Data