Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. function setup_theme_admin_menus() {
  2.     add_submenu_page('themes.php',
  3.         'Front Page Elements', 'Front Page', 'manage_options',
  4.         'front-page-elements', 'theme_front_page_settings');
  5. }
  6.  
  7. function theme_front_page_settings() {
  8.     ?>
  9.     <form method="POST" action="">
  10.         <h1>Google Webmaster Tools</h1>
  11.         <input type="text" name="wmt-code" value="<?php echo get_option("theme_wmt");?>"/>
  12.         <h1>Google Analytics Code</h1>
  13.         <textarea name="ga-code" rows="7" cols="50" /><?php echo get_option("theme_ga");?></textarea>
  14.         <input type="hidden" name="update_settings" value="Y" />
  15.     </form>
  16.     <?php
  17.     if (isset($_POST["update_settings"])) {
  18.         $wmt = esc_attr($_POST["wmt-code"]);  
  19.         $ga = $_POST["ga-code"];
  20.         update_option("theme_wmt", $wmt);
  21.         update_option("theme_ga", $ga);
  22.         ?>
  23.             <div id="message" class="updated">Settings saved</div>
  24.         <?php
  25.     }
  26. }
  27.  
  28. function add_wmt() {
  29.     ?>
  30.     <meta name="google-site-verification" content="<?php echo get_option("theme_wmt");?>">
  31.     <?php
  32. }
  33.  
  34. function add_ga() {
  35.     echo get_option("theme_ga");
  36. }
  37.  
  38. add_action("wp_head", "add_wmt");
  39. add_action("wp_footer", "add_ga");
  40. add_action("admin_menu", "setup_theme_admin_menus");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement