-
Notifications
You must be signed in to change notification settings - Fork 34
/
options.php
313 lines (268 loc) · 12.6 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
<?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 = wp_get_theme();
$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 'options_framework_theme'
* with the actual text domain for your theme. Read more:
* http://codex.wordpress.org/Function_Reference/load_theme_textdomain
*/
function optionsframework_options() {
// Test data
$test_array = array(
'one' => __('One', 'options_framework_theme'),
'two' => __('Two', 'options_framework_theme'),
'three' => __('Three', 'options_framework_theme'),
'four' => __('Four', 'options_framework_theme'),
'five' => __('Five', 'options_framework_theme')
);
// Multicheck Array
$multicheck_array = array(
'one' => __('French Toast', 'options_framework_theme'),
'two' => __('Pancake', 'options_framework_theme'),
'three' => __('Omelette', 'options_framework_theme'),
'four' => __('Crepe', 'options_framework_theme'),
'five' => __('Waffle', 'options_framework_theme')
);
// Multicheck Defaults
$multicheck_defaults = array(
'one' => '1',
'five' => '1'
);
// Background Defaults
$background_defaults = array(
'color' => '',
'image' => '',
'repeat' => 'repeat',
'position' => 'top center',
'attachment'=>'scroll' );
// Typography Defaults
$typography_defaults = array(
'size' => '15px',
'face' => 'georgia',
'style' => 'bold',
'color' => '#bada55' );
// Typography Options
$typography_options = array(
'sizes' => array( '6','12','14','16','20' ),
'faces' => array( 'Helvetica Neue' => 'Helvetica Neue','Arial' => 'Arial' ),
'styles' => array( 'normal' => 'Normal','bold' => 'Bold' ),
'color' => false
);
// 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;
}
// If using image radio buttons, define a directory path
$imagepath = get_template_directory_uri() . '/assets/img/';
// Add extra options through function(used by core)
if ( function_exists("jbst_options_add_before") )
$options = jbst_options_add_before();
else $options = array();
/*
==================================================================
SETUP
==================================================================
*/
$options[] = array( "name" => "Setup",
"type" => "heading" );
$options[] = array(
"name" => "Core Features",
'desc' => __('This theme is equipped with specific core features that we have made optional for you. By default, most are turned on, but you can deactivate any that you choose.', 'jamedo-bootstrap-start-theme'),
'type' => 'info' );
$options[] = array(
'name' => __('Automatic Page Titles', 'jamedo-bootstrap-start-theme'),
'desc' => __('By default, pages will automatically display their titles in a page header div with an <h1> tag wrapper. You can elect to turn this off and manually enter your titles in the page content.', 'jamedo-bootstrap-start-theme'),
'id' => 'display_page_title',
'std' => '1',
'class' => 'switch',
'type' => 'checkbox');
$options[] = array(
'name' => __('Automatic Thumbnails', 'jamedo-bootstrap-start-theme'),
'desc' => __('By default, if you have not specified a thumbnail, the theme will grab the first image from that post (if one exists) to use as a thumbnail on blog pages.', 'jamedo-bootstrap-start-theme'),
'id' => 'automatic_thumbnails',
'std' => '0',
'class' => 'switch',
'type' => 'checkbox');
$options[] = array(
'name' => __('Login Redirect to Homepage', 'jamedo-bootstrap-start-theme'),
'desc' => __('By default, users are redirected to the homepage of the site after login. You can turn this option off to enable default WordPress login behavior of redirecting to the WordPress dashboard. <em><strong>NOTE: This feature will be turned off if you do not have an account button in your navbar. This is to avoid locking you out of your site.</strong></em>', 'jamedo-bootstrap-start-theme'),
'id' => 'login_redirect_switch',
'std' => '0',
'class' => 'switch',
'type' => 'checkbox');
/*
==================================================================
LAYOUT
==================================================================
*/
$options[] = array( "name" => "Layout",
"type" => "heading" );
$options[] = array(
"name" => "How to use the site layout options...",
'desc' => __('The layout of your site is controlled by a combination of the options set on both this page and on individual post and page edit screens. You can specify unique layouts for the different blog areas of your site using the options on this page. The options, represented by images, are for right sidebar, full-width, left sidebar, and 3 column. Individual page layouts can be selected on the page edit screen below the editor. The site layout engine will then layout the page by first checking to see if the post or page has a unique layout chosen for it. If not, it will then check for the options below depending on the type of page that is being viewed. If no options are chosen for the site sections, the site layout engine will then use the default blog layout and default page layout. The sidebars can be configured under "Appearance > Widgets".'),
'type' => 'info' );
/* Recommend Custom Sidebars if not already there */
if ( !in_array( 'custom-sidebars/customsidebars.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
$options[] = array(
"name" => "Custom Sidebars Plugin",
'desc' => __('For the ultimate in flexibility, we recommend that you install and activate the <a target="_blank" href="http://wordpress.org/extend/plugins/custom-sidebars/">Custom Sidebars</a> plugin. This plugin will allow you to create new widget areas and assign them to any sidebar/widget location based on the criteria you set. For example, you may create widgets that only show up on a specific page or post, or create a widget for a specific blog category or just for your product pages. This message will disappear when the Custom Sidebars plugin is activated.'),
'type' => 'info' );
}
$options[] = array(
'name' => "Default Blog Layout",
'desc' => "The default blog layout will be used if no other option has been selected for each section of your site. This is also the layout for your main blog page. ",
'id' => "default_blog_layout",
'std' => "right-sidebar",
'type' => "images",
'options' => array(
'right-sidebar' => $imagepath . '2cl.png',
'full-width' => $imagepath . '1c.png',
'left-sidebar' => $imagepath . '2cr.png',
'three-column' => $imagepath . '3cm.png')
);
$options[] = array(
'name' => "Default Page Layout",
'desc' => "The default page layout will be used if no other option has been selected on the individual page's edit screen. ",
'id' => "default_page_layout",
'std' => "right-sidebar",
'type' => "images",
'options' => array(
'right-sidebar' => $imagepath . '2cl.png',
'full-width' => $imagepath . '1c.png',
'left-sidebar' => $imagepath . '2cr.png',
'three-column' => $imagepath . '3cm.png')
);
$options[] = array(
'name' => "Archive Layout",
'desc' => "Choose a layout for your archive pages. If none is selected, the default layout you specified at the top of this page will be used.",
'id' => "default_archive_layout",
'std' => "right-sidebar",
'type' => "images",
'options' => array(
'right-sidebar' => $imagepath . '2cl.png',
'full-width' => $imagepath . '1c.png',
'left-sidebar' => $imagepath . '2cr.png',
'three-column' => $imagepath . '3cm.png',)
);
$options[] = array(
'name' => "Category Layout",
'desc' => "Choose a layout for your category pages. If none is selected, the default layout you specified at the top of this page will be used.",
'id' => "default_category_layout",
'std' => "right-sidebar",
'type' => "images",
'options' => array(
'right-sidebar' => $imagepath . '2cl.png',
'full-width' => $imagepath . '1c.png',
'left-sidebar' => $imagepath . '2cr.png',
'three-column' => $imagepath . '3cm.png')
);
$options[] = array(
'name' => "Search Layout",
'desc' => "Choose a layout for your search return pages. If none is selected, the default layout you specified at the top of this page will be used.",
'id' => "default_search_layout",
'std' => "right-sidebar",
'type' => "images",
'options' => array(
'right-sidebar' => $imagepath . '2cl.png',
'full-width' => $imagepath . '1c.png',
'left-sidebar' => $imagepath . '2cr.png',
'three-column' => $imagepath . '3cm.png')
);
$options[] = array(
'name' => "404 / Not Found Layout",
'desc' => "Choose a layout for your 404/Not Found pages. If none is selected, the default layout you specified at the top of this page will be used.",
'id' => "default_404_layout",
'std' => "right-sidebar",
'type' => "images",
'options' => array(
'right-sidebar' => $imagepath . '2cl.png',
'full-width' => $imagepath . '1c.png',
'left-sidebar' => $imagepath . '2cr.png',
'three-column' => $imagepath . '3cm.png')
);
/*
==================================================================
SHOP
==================================================================
*/
global $jbstecommerce;
if ($jbstecommerce == true) {
$options[] = array( "name" => "Shop",
"type" => "heading" );
$options[] = array(
"name" => "eCommerce Options",
'desc' => __("The ecommerce options only appear if you have activated one of the compatible ecommerce platforms, which are WooCommerce, JigoShop and WP eCommerce. You may only activate one of these platforms at a time, and the theme will automatically detect which platform is installed and update any applicable code for you. This will affect CSS styles, the cart and account dropdown functions, etc.", 'jamedo-bootstrap-start-theme'),
'type' => 'info' );
$options[] = array(
'name' => "Shop Layout",
'desc' => "Choose a layout for your shop page. If none is selected, the default layout you specified at the top of this page will be used.",
'id' => "default_shop_layout",
'std' => "right-sidebar",
'type' => "images",
'options' => array(
'right-sidebar' => $imagepath . '2cl.png',
'full-width' => $imagepath . '1c.png',
'left-sidebar' => $imagepath . '2cr.png',
'three-column' => $imagepath . '3cm.png')
);
$options[] = array(
'name' => "Product Layout",
'desc' => "Choose a layout for your single products. If none is selected, the default layout you specified at the top of this page will be used.",
'id' => "default_product_layout",
'std' => "right-sidebar",
'type' => "images",
'options' => array(
'right-sidebar' => $imagepath . '2cl.png',
'full-width' => $imagepath . '1c.png',
'left-sidebar' => $imagepath . '2cr.png',
'three-column' => $imagepath . '3cm.png')
);
} //END OF CHECK FOR ECOMMERCE
/*
==================================================================
CUSTOM CSS
==================================================================
*/
/*$options[] = array( "name" => "Custom LESS",
"type" => "heading" );
$options[] = array(
"name" => "Custom LESS Editor",
'desc' => __("Use the LESS editor below to add custom styles to your site. Any styles added here won't be affected by upgrading your theme."),
'type' => 'info' );
$options[] = array(
'desc' => "",
'id' => "customlesscode",
'std' => " Add custom LESS below ",
'type' => "textarea"
);*/
return $options;
}