-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.php
377 lines (298 loc) · 15.4 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<?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 (lowercase and without spaces)
$theme = wp_get_theme();
$themename = $theme->Name;
$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.
*
*/
function optionsframework_options() {
// Home Project Type
$home_project_type = array("all" => "All projects", "featured" => "Featured");
// Post Featured Image Size
$post_featured_image_size = array("large" => "Large", "small" => "Small");
// Slideshow Transition Effect
$slideshow_effect = array("slide" => "Slide", "fade" => "Fade");
// 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;
}
// If using image radio buttons, define a directory path
$imagepath = get_bloginfo('stylesheet_directory') . '/images/';
$options = array();
$options[] = array( "name" => __('General','themetrust'),
"type" => "heading");
$options[] = array( "name" => __('Logo','themetrust'),
"desc" => __('Upload a custom logo.','themetrust'),
"id" => "logo",
"type" => "upload");
$options[] = array( "name" => __('Favicon','themetrust'),
"desc" => __('Upload a custom favicon.','themetrust'),
"id" => "ttrust_favicon",
"type" => "upload");
$options[] = array( "name" => __('Custom CSS','themetrust'),
"desc" => __('Enter custom CSS here.','themetrust'),
"id" => "ttrust_custom_css",
"std" => "",
"type" => "textarea");
$options[] = array( "name" => __('Appearance','themetrust'),
"type" => "heading");
$options[] = array( "name" => __('Header Color','themetrust'),
"desc" => __('Select a header color for your theme.','themetrust'),
"id" => "ttrust_color_header",
"std" => "#74c9b4",
"type" => "color");
$options[] = array( "name" => __('Accent Color','themetrust'),
"desc" => __('Select an accent color for your theme.','themetrust'),
"id" => "ttrust_color_accent",
"std" => "#74c9b4",
"type" => "color");
$options[] = array( "name" => __('Button Color','themetrust'),
"desc" => __('Select a color for your buttons.','themetrust'),
"id" => "ttrust_color_btn",
"std" => "#757575",
"type" => "color");
$options[] = array( "name" => __('Button Hover Color','themetrust'),
"desc" => __('Select a hover color for your buttons.','themetrust'),
"id" => "ttrust_color_btn_hover",
"std" => "#595959",
"type" => "color");
$options[] = array( "name" => __('Link Color','themetrust'),
"desc" => __('Select a color for your links.','themetrust'),
"id" => "ttrust_color_link",
"std" => "#4da7ca",
"type" => "color");
$options[] = array( "name" => __('Link Hover Color','themetrust'),
"desc" => __('Select a hover color for your links.','themetrust'),
"id" => "ttrust_color_link_hover",
"std" => "#4290ae",
"type" => "color");
$options[] = array( "name" => __('Home Page','themetrust'),
"type" => "heading");
$options['ttrust_slideshow_enabled'] = array( "name" => __('Enable Slideshow','themetrust'),
"desc" => __('Check this box to enable the home page slideshow.','themetrust'),
"id" => "ttrust_slideshow_enabled",
"std" => "1",
"type" => "checkbox");
$options[] = array( "name" => __('Recent Projects Title','themetrust'),
"desc" => __('Enter the title that will appear above the recent themes section on the home page.','themetrust'),
"id" => "ttrust_recent_projects_title",
"std" => "Our Latest Work",
"type" => "text");
$options[] = array( "name" => __('Recent Projects Description','themetrust'),
"desc" => __('Enter the description that will appear above the recent projects section on the home page.','themetrust'),
"id" => "ttrust_recent_projects_description",
"std" => "Take a look at some of our recent projects.",
"type" => "textarea");
$options[] = array( "name" => __('Number of Projects to Show','themetrust'),
"desc" => __('Enter the number of project to show on the home page.','themetrust'),
"id" => "ttrust_home_project_count",
"std" => "6",
"type" => "text");
$options[] = array( "name" => __('Type of Projects to Show','themetrust'),
"desc" => __('Select the type of projects to show on the home page.','themetrust'),
"id" => "ttrust_home_project_type",
"std" => "latest",
"type" => "select",
"options" => $home_project_type);
$options[] = array( "name" => __('Testimonials Title','themetrust'),
"desc" => __('Enter the title that will appear above the testimonials section on the home page.','themetrust'),
"id" => "ttrust_testimonials_title",
"std" => "Testimonials",
"type" => "text");
$options[] = array( "name" => __('Testimonials Description','themetrust'),
"desc" => __('Enter the description that will appear above the testimonials section on the home page.','themetrust'),
"id" => "ttrust_testimonials_description",
"std" => "What our customers are saying.",
"type" => "textarea");
$options[] = array( "name" => __('Number of Testimonials to Show','themetrust'),
"desc" => __('Enter the number of Testimonials to show on the home page.','themetrust'),
"id" => "ttrust_home_testimonial_count",
"std" => "3",
"type" => "text");
$options[] = array( "name" => __('Featured Pages Title','themetrust'),
"desc" => __('Enter the title that will appear above the featured pages section on the home page.','themetrust'),
"id" => "ttrust_featured_pages_title",
"std" => "Our Services",
"type" => "text");
$options[] = array( "name" => __('Featured Pages Description','themetrust'),
"desc" => __('Enter the description that will appear above the featured pages section on the home page.','themetrust'),
"id" => "ttrust_featured_pages_description",
"std" => "A little about what we do.",
"type" => "textarea");
$options[] = array( "name" => __('Number of Featured Pages to Show','themetrust'),
"desc" => __('Enter the number of featured pages to show on the home page.','themetrust'),
"id" => "ttrust_featured_pages_count",
"std" => "6",
"type" => "text");
$options[] = array( "name" => __('Enable Featured Pages Links','themetrust'),
"desc" => __('Check this box to have the featured pages link to their corresponding single page when clicked.','themetrust'),
"id" => "ttrust_featured_pages_links_enabled",
"std" => "1",
"type" => "checkbox");
$options[] = array( "name" => __('Recent Posts Title','themetrust'),
"desc" => __('Enter the title that will appear above the posts section on the home page.','themetrust'),
"id" => "ttrust_recent_posts_title",
"std" => "From the Bog",
"type" => "text");
$options[] = array( "name" => __('Recent Posts Description','themetrust'),
"desc" => __('Enter the description that will appear above the posts section on the home page.','themetrust'),
"id" => "ttrust_recent_posts_description",
"std" => "",
"type" => "textarea");
$options[] = array( "name" => __('Number of Recent Posts to Show','themetrust'),
"desc" => __('Enter the number of recent posts to show on the home page.','themetrust'),
"id" => "ttrust_recent_posts_count",
"std" => "3",
"type" => "text");
$options[] = array( "name" => __('Typography','themetrust'),
"type" => "heading");
$options[] = array( "name" => __('Font for Home Slideshow Title','themetrust'),
"desc" => __('Enter the name of the <a href="http://www.google.com/webfonts" target="_blank">Google Web Font</a> you want to use for home slideshow titles.','themetrust'),
"id" => "ttrust_slideshow_heading_font",
"std" => "",
"type" => "text");
$options[] = array( "name" => __('Font for Home Slideshow Description','themetrust'),
"desc" => __('Enter the name of the <a href="http://www.google.com/webfonts" target="_blank">Google Web Font</a> you want to use for home slideshow descriptions.','themetrust'),
"id" => "ttrust_slideshow_description_font",
"std" => "",
"type" => "text");
$options[] = array( "name" => __('Font for Headings','themetrust'),
"desc" => __('Enter the name of the <a href="http://www.google.com/webfonts" target="_blank">Google Web Font</a> you want to use for headings.','themetrust'),
"id" => "ttrust_heading_font",
"std" => "",
"type" => "text");
$options[] = array( "name" => __('Font for Sub Headings','themetrust'),
"desc" => __('Enter the name of the <a href="http://www.google.com/webfonts" target="_blank">Google Web Font</a> you want to use for sub headings.','themetrust'),
"id" => "ttrust_sub_heading_font",
"std" => "",
"type" => "text");
$options[] = array( "name" => __('Font for Body Text','themetrust'),
"desc" => __('Enter the name of the <a href="http://www.google.com/webfonts" target="_blank">Google Web Font</a> you want to use for the body text.','themetrust'),
"id" => "ttrust_body_font",
"std" => "",
"type" => "text");
$options[] = array( "name" => __('Font for Main Menu','themetrust'),
"desc" => __('Enter the name of the <a href="http://www.google.com/webfonts" target="_blank">Google Web Font</a> you want to use for the main menu.','themetrust'),
"id" => "ttrust_menu_font",
"std" => "",
"type" => "text");
$options[] = array( "name" => __('Slideshow','themetrust'),
"type" => "heading");
$options[] = array( "name" => __('Slideshow Delay','themetrust'),
"desc" => __('Enter the delay in seconds between slides. Enter 0 to disable auto-playing.','themetrust'),
"id" => "ttrust_slideshow_delay",
"std" => "6",
"type" => "text");
$options[] = array( "name" => __('Slideshow Effect','themetrust'),
"desc" => __('Select the type of transition effect for the slideshow.','themetrust'),
"id" => "ttrust_slideshow_effect",
"std" => "fade",
"type" => "select",
"options" => $slideshow_effect);
$options[] = array( "name" => __('Posts','themetrust'),
"type" => "heading");
$options[] = array( "name" => __('Show Author','themetrust'),
"desc" => __('Check this box to show the author.','themetrust'),
"id" => "ttrust_post_show_author",
"std" => "1",
"type" => "checkbox");
$options[] = array( "name" => __('Show Date','themetrust'),
"desc" => __('Check this box to show the publish date.','themetrust'),
"id" => "ttrust_post_show_date",
"std" => "1",
"type" => "checkbox");
$options[] = array( "name" => __('Show Category','themetrust'),
"desc" => __('Check this box to show the category.','themetrust'),
"id" => "ttrust_post_show_category",
"std" => "1",
"type" => "checkbox");
$options[] = array( "name" => __('Show Comment Count','themetrust'),
"desc" => __('Check this box to show the comment count.','themetrust'),
"id" => "ttrust_post_show_comments",
"std" => "1",
"type" => "checkbox");
$options[] = array( "name" => __('Featured Image Size','themetrust'),
"desc" => __('Select the size of the post featured image.','themetrust'),
"id" => "ttrust_post_featured_img_size",
"std" => "large",
"type" => "select",
"options" => $post_featured_image_size);
$options[] = array( "name" => __('Show Featured Image on Single Posts','themetrust'),
"desc" => __('Check this box to show the featured image on single post pages.','themetrust'),
"id" => "ttrust_post_show_featured_image",
"std" => "0",
"type" => "checkbox");
$options[] = array( "name" => __('Show Featured Image on Home Page','themetrust'),
"desc" => __('Check this box to show the featured image on the home page template.','themetrust'),
"id" => "ttrust_post_show_featured_image_on_home",
"std" => "",
"type" => "checkbox");
$options[] = array( "name" => __('Enable Full Width Blog','themetrust'),
"desc" => __('Check this box to make your posts span the width of the page.','themetrust'),
"id" => "ttrust_post_full_width",
"std" => "0",
"type" => "checkbox");
$options[] = array( "name" => __('Show Full Posts','themetrust'),
"desc" => __('Check this box to show full posts instead of excerpts on index and archive pages.','themetrust'),
"id" => "ttrust_post_show_full",
"std" => "0",
"type" => "checkbox");
$options[] = array( "name" => "Select a Page",
"desc" => "Select the page you're using as your blog page. This is used to show the blog title at the top of your posts.",
"id" => "ttrust_blog_page",
"type" => "select",
"options" => $options_pages);
$options[] = array( "name" => __('Footer','themetrust'),
"type" => "heading");
$options[] = array( "name" => __('Google Map Address','themetrust'),
"desc" => __('Enter the address to display on your Google Map.','themetrust'),
"id" => "ttrust_google_map_address",
"std" => "",
"type" => "textarea");
$options[] = array( "name" => __('Google Map Height','themetrust'),
"desc" => __('Enter a height in pixels for your Google Map.','themetrust'),
"id" => "ttrust_google_map_height",
"std" => "350",
"type" => "text");
$options[] = array( "name" => __('Google Map Tint Color','themetrust'),
"desc" => __('Select a tint color for your Google Map.','themetrust'),
"id" => "ttrust_google_map_tint",
"std" => "#79d1bb",
"type" => "color");
$options[] = array( "name" => __('Left Footer Text','themetrust'),
"desc" => __('This will appear on the left side of the footer.','themetrust'),
"id" => "ttrust_footer_left",
"std" => "",
"type" => "textarea");
$options[] = array( "name" => __('Right Footer Text','themetrust'),
"desc" => __('This will appear on the right side of the footer.','themetrust'),
"id" => "ttrust_footer_right",
"std" => "",
"type" => "textarea");
$options[] = array( "name" => __('Integration','themetrust'),
"type" => "heading");
$options[] = array( "name" => __('Analytics','themetrust'),
"desc" => __('Enter your custom analytics code. (e.g. Google Analytics).','themetrust'),
"id" => "ttrust_analytics",
"std" => "",
"type" => "textarea",
"validate" => "none");
return $options;
}