/
settings.php
37 lines (26 loc) · 1.13 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
add_action('admin_menu', 'extra_settings_menu');
function extra_settings_menu() {
add_menu_page('Extra Settings', 'Extra Settings', 'administrator', __FILE__, 'extra_settings_html');
add_action('admin_init', 'register_mysettings');
}
function register_mysettings() {
register_setting('extra_settings_group', 'ga_tracking_code');
}
function extra_settings_html() { ?>
<div class="wrap">
<h2>Extra Settings</h2>
<form method="post" action="options.php">
<?php settings_fields('extra_settings_group'); ?>
<table class="form-table">
<tr valign="top">
<th>Google Tracking UA Code</th>
<td><input type="text" name="ga_tracking_code" value="<?php echo get_option('ga_tracking_code'); ?>" placeholder="UA-1234567-89" /></td>
</tr>
</table>
<p class="submit">
<input type="submit" class="button-primary" value="Save Changes" />
</p>
</form>
</div>
<?php }