-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.php
280 lines (238 loc) · 9.23 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
<?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() {
$themename = get_option( 'stylesheet' );
$themename = preg_replace( "/\W/", "_", strtolower( $themename ) );
return $themename;
}
/**
* 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 'wpas'
* with the actual text domain for your theme. Read more:
* http://codex.wordpress.org/Function_Reference/load_theme_textdomain
*/
function optionsframework_options() {
// If using image radio buttons, define a directory path
$imagepath = trailingslashit( get_template_directory_uri() ) . 'images/';
// Background Defaults
$background_defaults = array(
'color' => '#222222',
'image' => $imagepath . 'dark-noise.jpg',
'repeat' => 'repeat',
'position' => 'top left',
'attachment'=>'scroll' );
// Editor settings
$wp_editor_settings = array(
'wpautop' => true, // Default
'textarea_rows' => 5,
'tinymce' => array( 'plugins' => 'wordpress' )
);
// Footer Position settings
$footer_position_settings = array(
'left' => esc_html__( 'Left aligned', 'wpas' ),
'center' => esc_html__( 'Center aligned', 'wpas' ),
'right' => esc_html__( 'Right aligned', 'wpas' )
);
// Number of shop products
$shop_products_settings = array(
'4' => esc_html__( '4 Products', 'wpas' ),
'8' => esc_html__( '8 Products', 'wpas' ),
'12' => esc_html__( '12 Products', 'wpas' ),
'16' => esc_html__( '16 Products', 'wpas' ),
'20' => esc_html__( '20 Products', 'wpas' ),
'24' => esc_html__( '24 Products', 'wpas' ),
'28' => esc_html__( '28 Products', 'wpas' )
);
$options = array();
$options[] = array(
'name' => esc_html__( 'Basic Settings', 'wpas' ),
'type' => 'heading' );
$options[] = array(
'name' => esc_html__( 'Background', 'wpas' ),
'desc' => sprintf( wp_kses( __( 'If you’d like to replace or remove the default background image, use the <a href="%1$s" title="Custom background">Appearance > Background</a> menu option.', 'wpas' ), array(
'a' => array(
'href' => array(),
'title' => array() )
) ), admin_url( 'themes.php?page=custom-background' ) ),
'type' => 'info' );
$options[] = array(
'name' => esc_html__( 'Logo', 'wpas' ),
'desc' => sprintf( wp_kses( __( 'If you’d like to replace or remove the default logo, use the <a href="%1$s" title="Custom header">Appearance > Header</a> menu option.', 'wpas' ), array(
'a' => array(
'href' => array(),
'title' => array() )
) ), admin_url( 'themes.php?page=custom-header' ) ),
'type' => 'info' );
$options[] = array(
'name' => esc_html__( 'Social Media Settings', 'wpas' ),
'desc' => esc_html__( 'Enter the URLs for your Social Media platforms. You can also optionally specify whether you want these links opened in a new browser tab/window.', 'wpas' ),
'type' => 'info' );
$options[] = array(
'name' => esc_html__('Open links in new Window/Tab', 'wpas'),
'desc' => esc_html__('Open the social media links in a new browser tab/window', 'wpas'),
'id' => 'social_newtab',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => esc_html__( 'Twitter', 'wpas' ),
'desc' => esc_html__( 'Enter your Twitter URL.', 'wpas' ),
'id' => 'social_twitter',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'Facebook', 'wpas' ),
'desc' => esc_html__( 'Enter your Facebook URL.', 'wpas' ),
'id' => 'social_facebook',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'Google+', 'wpas' ),
'desc' => esc_html__( 'Enter your Google+ URL.', 'wpas' ),
'id' => 'social_googleplus',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'LinkedIn', 'wpas' ),
'desc' => esc_html__( 'Enter your LinkedIn URL.', 'wpas' ),
'id' => 'social_linkedin',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'SlideShare', 'wpas' ),
'desc' => esc_html__( 'Enter your SlideShare URL.', 'wpas' ),
'id' => 'social_slideshare',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'Dribbble', 'wpas' ),
'desc' => esc_html__( 'Enter your Dribbble URL.', 'wpas' ),
'id' => 'social_dribbble',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'Tumblr', 'wpas' ),
'desc' => esc_html__( 'Enter your Tumblr URL.', 'wpas' ),
'id' => 'social_tumblr',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'GitHub', 'wpas' ),
'desc' => esc_html__( 'Enter your GitHub URL.', 'wpas' ),
'id' => 'social_github',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'Bitbucket', 'wpas' ),
'desc' => esc_html__( 'Enter your Bitbucket URL.', 'wpas' ),
'id' => 'social_bitbucket',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'Foursquare', 'wpas' ),
'desc' => esc_html__( 'Enter your Foursquare URL.', 'wpas' ),
'id' => 'social_foursquare',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'YouTube', 'wpas' ),
'desc' => esc_html__( 'Enter your YouTube URL.', 'wpas' ),
'id' => 'social_youtube',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'Instagram', 'wpas' ),
'desc' => esc_html__( 'Enter your Instagram URL.', 'wpas' ),
'id' => 'social_instagram',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'Flickr', 'wpas' ),
'desc' => esc_html__( 'Enter your Flickr URL.', 'wpas' ),
'id' => 'social_flickr',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'Pinterest', 'wpas' ),
'desc' => esc_html__( 'Enter your Pinterest URL.', 'wpas' ),
'id' => 'social_pinterest',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'RSS', 'wpas' ),
'desc' => esc_html__( 'Enter your RSS Feed URL.', 'wpas' ),
'id' => 'social_rss',
'std' => '',
'type' => 'text' );
$options[] = array(
'name' => esc_html__( 'Advanced settings', 'wpas' ),
'type' => 'heading' );
$options[] = array(
'name' => esc_html__( 'Banner Background', 'wpas' ),
'desc' => esc_html__( 'Select an image and background color for the homepage banner.', 'wpas' ),
'id' => 'banner_background',
'std' => $background_defaults,
'type' => 'background' );
$options[] = array(
'name' => esc_html__( 'Footer Background Color', 'wpas' ),
'desc' => esc_html__( 'Select the background color for the footer.', 'wpas' ),
'id' => 'footer_color',
'std' => '#222222',
'type' => 'color' );
$options[] = array(
'name' => esc_html__( 'Footer Content', 'wpas' ),
'desc' => esc_html__( 'Enter the text you‘d like to display in the footer. This content will be displayed just below the footer widgets. It‘s ideal for displaying your copyright message or credits.', 'wpas' ),
'id' => 'footer_content',
'std' => wpas_get_credits(),
'type' => 'editor',
'settings' => $wp_editor_settings );
$options[] = array(
'name' => esc_html__( 'Footer Content Position', 'wpas' ),
'desc' => esc_html__( 'Select what position you would like the footer content aligned to.', 'wpas' ),
'id' => 'footer_position',
'std' => 'center',
'type' => 'select',
'class' => 'mini',
'options' => $footer_position_settings );
if( wpas_is_woocommerce_active() ) {
$options[] = array(
'name' => esc_html__( 'WooCommerce settings', 'wpas' ),
'type' => 'heading' );
$options[] = array(
'name' => esc_html__('Shop sidebar', 'wpas'),
'desc' => esc_html__('Display the sidebar on the WooCommerce Shop page', 'wpas'),
'id' => 'woocommerce_shopsidebar',
'std' => '1',
'type' => 'checkbox');
$options[] = array(
'name' => esc_html__('Products sidebar', 'wpas'),
'desc' => esc_html__('Display the sidebar on the WooCommerce Single Product page', 'wpas'),
'id' => 'woocommerce_productsidebar',
'std' => '1',
'type' => 'checkbox');
$options[] = array(
'name' => esc_html__( 'Cart, Checkout & My Account sidebars', 'wpas' ),
'desc' => esc_html__( 'The ‘Cart’, ‘Checkout’ and ‘My Account’ pages are displayed using shortcodes. To remove the sidebar from these Pages, simply edit each Page and change the Template (in the Page Attributes Panel) to the ‘Full-width Page Template’.', 'wpas' ),
'type' => 'info' );
$options[] = array(
'name' => esc_html__('Shop Breadcrumbs', 'wpas'),
'desc' => esc_html__('Display the breadcrumbs on the WooCommerce pages', 'wpas'),
'id' => 'woocommerce_breadcrumbs',
'std' => '1',
'type' => 'checkbox');
$options[] = array(
'name' => esc_html__( 'Shop Products', 'wpas' ),
'desc' => esc_html__( 'Select the number of products to display on the shop page.', 'wpas' ),
'id' => 'shop_products',
'std' => '12',
'type' => 'select',
'class' => 'mini',
'options' => $shop_products_settings );
}
return $options;
}