This repository has been archived by the owner on Oct 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 286
/
options.php
176 lines (159 loc) · 5.35 KB
/
options.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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
/**
* A unique identifier is defined to store the options in the database and reference them from the theme.
* By default it uses the theme name, in lowercase and without spaces, but this can be changed if needed.
* If the identifier changes, it'll appear as if the options have been reset.
*/
function optionsframework_option_name() {
// This gets the theme name from the stylesheet
$themename = get_option( 'stylesheet' );
$themename = preg_replace("/\W/", "_", strtolower($themename) );
$optionsframework_settings = get_option( 'optionsframework' );
$optionsframework_settings['id'] = $themename;
update_option( 'optionsframework', $optionsframework_settings );
}
/**
* Defines an array of options that will be used to generate the settings page and be saved in the database.
* When creating the 'id' fields, make sure to use all lowercase and no spaces.
*
* If you are making your theme translatable, you should replace 'html5reset'
* with the actual text domain for your theme. Read more:
* http://codex.wordpress.org/Function_Reference/load_theme_textdomain
*/
function optionsframework_options() {
// Pull all the categories into an array
$options_categories = array();
$options_categories_obj = get_categories();
foreach ($options_categories_obj as $category) {
$options_categories[$category->cat_ID] = $category->cat_name;
}
// Pull all tags into an array
$options_tags = array();
$options_tags_obj = get_tags();
foreach ( $options_tags_obj as $tag ) {
$options_tags[$tag->term_id] = $tag->name;
}
// Pull all the pages into an array
$options_pages = array();
$options_pages_obj = get_pages('sort_column=post_parent,menu_order');
$options_pages[''] = 'Select a page:';
foreach ($options_pages_obj as $page) {
$options_pages[$page->ID] = $page->post_title;
}
$options = array();
$options[] = array(
'name' => __('Header Meta', 'html5reset'),
'type' => 'heading');
// Standard Meta
$options[] = array(
'name' => __('Head ID', 'html5reset'),
'desc' => __("", 'html5reset'),
'id' => 'meta_headid',
'std' => 'www-sitename-com',
'type' => 'text');
$options[] = array(
'name' => __('Google Webmasters', 'html5reset'),
'desc' => __("Speaking of Google, don't forget to set your site up: <a href='http://google.com/webmasters' target='_blank'>http://google.com/webmasters</a>", 'html5reset'),
'id' => 'meta_google',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Author Name', 'html5reset'),
'desc' => __('Populates meta author tag.', 'html5reset'),
'id' => 'meta_author',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Mobile Viewport', 'html5reset'),
'desc' => __('Uncomment to use; use thoughtfully!', 'html5reset'),
'id' => 'meta_viewport',
'std' => 'width=device-width, initial-scale=1.0',
'type' => 'text');
// Icons
$options[] = array(
'name' => __('Site Favicon', 'html5reset'),
'desc' => __('', 'html5reset'),
'id' => 'head_favicon',
'type' => 'upload');
$options[] = array(
'name' => __('Apple Touch Icon', 'html5reset'),
'desc' => __('', 'html5reset'),
'id' => 'head_apple_touch_icon',
'type' => 'upload');
// App: Windows 8
$options[] = array(
'name' => __('App: Windows 8', 'html5reset'),
'desc' => __('Application Name', 'html5reset'),
'id' => 'meta_app_win_name',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('', 'html5reset'),
'desc' => __('Tile Color', 'html5reset'),
'id' => 'meta_app_win_color',
'std' => '',
'type' => 'color');
$options[] = array(
'name' => __('', 'html5reset'),
'desc' => __('Tile Image', 'html5reset'),
'id' => 'meta_app_win_image',
'std' => '',
'type' => 'upload');
// App: Twitter
$options[] = array(
'name' => __('App: Twitter Card', 'html5reset'),
'desc' => __('twitter:card (summary, photo, gallery, product, app, player)', 'html5reset'),
'id' => 'meta_app_twt_card',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('', 'html5reset'),
'desc' => __('twitter:site (@username of website)', 'html5reset'),
'id' => 'meta_app_twt_site',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('', 'html5reset'),
'desc' => __("twitter:title (the user's Twitter ID)", 'html5reset'),
'id' => 'meta_app_twt_title',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('', 'html5reset'),
'desc' => __('twitter:description (maximum 200 characters)', 'html5reset'),
'id' => 'meta_app_twt_description',
'std' => '',
'type' => 'textarea');
$options[] = array(
'name' => __('', 'html5reset'),
'desc' => __('twitter:url (url for the content)', 'html5reset'),
'id' => 'meta_app_twt_url',
'std' => '',
'type' => 'text');
// App: Facebook
$options[] = array(
'name' => __('App: Facebook', 'html5reset'),
'desc' => __('og:title', 'html5reset'),
'id' => 'meta_app_fb_title',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('', 'html5reset'),
'desc' => __('og:description', 'html5reset'),
'id' => 'meta_app_fb_description',
'std' => '',
'type' => 'textarea');
$options[] = array(
'name' => __('', 'html5reset'),
'desc' => __('og:url', 'html5reset'),
'id' => 'meta_app_fb_url',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('', 'html5reset'),
'desc' => __('og:image', 'html5reset'),
'id' => 'meta_app_fb_image',
'std' => '',
'type' => 'upload');
return $options;
}