-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.php
More file actions
81 lines (53 loc) · 1.49 KB
/
plugin.php
File metadata and controls
81 lines (53 loc) · 1.49 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/**
* Plugin Name: WordPress Version Number
* Plugin URI:
* Description: Allows you to store the version of WP your on
* Version: 1.0
* Author: Stephanie Spring
* Author URI:
* License
*/
add_action( 'admin_menu', 'wpvnum_add_admin_menu' );
add_action( 'admin_init', 'wpvnum_settings_init' );
function wpvnum_add_admin_menu( ) {
add_options_page( 'WordPress Version Number', 'WordPress Version Number', 'manage_options', 'wordpress_version_number', 'wordpress_version_number_options_page' );
}
function wpvnum_settings_init( ) {
register_setting( 'pluginPage', 'wpvnum_settings' );
add_settings_section(
'wpvnum_pluginPage_section',
__( 'Your section description', 'wordpress' ),
'wpvnum_settings_section_callback',
'pluginPage'
);
add_settings_field(
'wpvnum_text_field_0',
__( 'Settings field description', 'wordpress' ),
'wpvnum_text_field_0_render',
'pluginPage',
'wpvnum_pluginPage_section'
);
}
function wpvnum_text_field_0_render( ) {
$options = get_option( 'wpvnum_settings' );
?>
<input type='text' name='wpvnum_settings[wpvnum_text_field_0]' value='<?php echo $options['wpvnum_text_field_0']; ?>'>
<?php
}
function wpvnum_settings_section_callback( ) {
echo __( 'This section description', 'wordpress' );
}
function wpvnum_options_page( ) {
?>
<form action='options.php' method='post'>
<h2>WordPress Version Number</h2>
<?php
settings_fields( 'pluginPage' );
do_settings_sections( 'pluginPage' );
submit_button();
?>
</form>
<?php
}
?>