Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2014
568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.08 KB | None | 0 0
  1. <?php
  2. /* ========================================================================================================================
  3.    
  4.     Custom Admin Menu
  5.    
  6.     ======================================================================================================================== */
  7.  
  8.     add_action( 'admin_menu', 'site_options_menu' );
  9.  
  10.     function site_options_menu() {
  11.         add_menu_page( 'Company Info', 'Company Info', 'manage_options', 'company-info-options', 'site_options' );
  12.     }
  13.  
  14.     add_action('admin_init', 'register_settings');
  15.  
  16.     function register_settings() {  
  17.         register_setting('settings-group','phonenumber');
  18.         register_setting('settings-group','primaryemail');
  19.         register_setting('settings-group','secondemail');
  20.         register_setting('settings-group','address1');
  21.         register_setting('settings-group','address2');
  22.         register_setting('settings-group','address3');
  23.         register_setting('settings-group','address4');
  24.         register_setting('settings-group','town');
  25.         register_setting('settings-group','postcode');
  26.         register_setting('settings-group','facebook');
  27.         register_setting('settings-group','twitter');
  28.         register_setting('settings-group','linkedin');
  29.         register_setting('settings-group','googleplus');
  30.         register_setting('settings-group','pinterest');
  31.     }
  32.  
  33.     function site_options()
  34.         {
  35.         ?>
  36.         <div class="wrap">
  37.             <h2>Company Options</h2>
  38.  
  39.             <p>This is where some global information about your company is stored. You can add information here to be used across the site.</p>
  40.  
  41.                 <form method="post" action="options.php">
  42.                 <p><input type="submit" value="Save" class="button-primary" /></p>
  43.                     <fieldset style="border: 1px solid #ccc !important;padding: 10px !important;"><legend>Contact Information</legend>
  44.                                 <p><strong>Phone Number:</strong><br />
  45.                                     <input type="text" name="phonenumber" size="45" value="<?php echo get_option('phonenumber'); ?>" />
  46.                                 </p>
  47.                                 <p><strong>Primary Email:</strong><br />
  48.                                     <input type="text" name="primaryemail" size="45" value="<?php echo get_option('primaryemail'); ?>" />
  49.                                     <br /><small>This is the email that will be used first, when only one contact email is output</small>
  50.                                 </p>
  51.                                 <p><strong>Secondary Email:</strong><br />
  52.                                     <input type="text" name="secondemail" size="45" value="<?php echo get_option('secondemail'); ?>" />
  53.                                 </p>
  54.                     </fieldset>
  55.                             <br />
  56.                     <fieldset style="border: 1px solid #ccc !important;padding: 10px !important;"><legend>Address</legend>
  57.                                 <p><strong>Line 1:</strong><br />
  58.                                     <input type="text" name="address1" size="45" value="<?php echo get_option('address1'); ?>" />
  59.                                 </p>
  60.                                 <p><strong>Line 2:</strong><br />
  61.                                     <input type="text" name="address2" size="45" value="<?php echo get_option('address2'); ?>" />
  62.                                 </p>
  63.                                 <p><strong>Line 3:</strong><br />
  64.                                     <input type="text" name="address3" size="45" value="<?php echo get_option('address3'); ?>" />
  65.                                 </p>
  66.                                 <p><strong>Line 4:</strong><br />
  67.                                     <input type="text" name="address4" size="45" value="<?php echo get_option('address4'); ?>" />
  68.                                 </p>
  69.                                 <p><strong>Town:</strong><br />
  70.                                     <input type="text" name="town" size="45" value="<?php echo get_option('town'); ?>" />
  71.                                 </p>
  72.                                 <p><strong>Postcode:</strong><br />
  73.                                     <input type="text" name="postcode" size="45" value="<?php echo get_option('postcode'); ?>" />
  74.                                 </p>
  75.                             </fieldset>
  76.                             <br />
  77.                     <fieldset style="border: 1px solid #ccc !important;padding: 10px !important;"><legend>Social Accounts</legend>
  78.                             <small>Please include http://www. at the beginning of the link</small><br/>
  79.                                 <p><strong>Facebook:</strong><br />
  80.                                     <input type="text" name="facebook" size="45" value="<?php echo get_option('facebook'); ?>" />
  81.                                 </p>
  82.                                 <p><strong>Twitter:</strong><br />
  83.                                     <input type="text" name="twitter" size="45" value="<?php echo get_option('twitter'); ?>" />
  84.                                 </p>
  85.                                 <p><strong>LinkedIn:</strong><br />
  86.                                     <input type="text" name="linkedin" size="45" value="<?php echo get_option('linkedin'); ?>" />
  87.                                 </p>
  88.                                 <p><strong>Google+:</strong><br />
  89.                                     <input type="text" name="googleplus" size="45" value="<?php echo get_option('googleplus'); ?>" />
  90.                                 </p>
  91.                                 <p><strong>Pinterest:</strong><br />
  92.                                     <input type="text" name="pinterest" size="45" value="<?php echo get_option('pinterest'); ?>" />
  93.                                 </p>
  94.                     </fieldset>
  95.                     <p><input type="submit" value="Save" class="button-primary" /></p>
  96.                 </form>
  97.         </div>
  98.         <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement