Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 621 lines (573 sloc) 20.509 kB
256ad86 @tlongren Add initial theme options page. Mostly to enable/disable the "back to…
authored
1 <?php
2
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
3 // Default options values
b2787d2 @tlongren Use wp_enqueue_scripts() to add styles instead of wp_print_styles(). …
authored
4 // Kept for back-compat for now because I don't want to convert all the option calls to the new before I've heard your opinion
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
5 $html5press_options = array(
d97ab85 @tlongren Add option to set size of image that's linked to from featured images.
authored
6 'back_to_top' => true,
f033f6d @tlongren Add option for infinite scrolling!
authored
7 'infinite_scroll' => true,
87a8a2d @tlongren Add option to disable the tagline from showing in the header.
authored
8 'show_tagline' => true,
acc2e69 @tlongren Add slimbox2 to HTML5Press. It's disabled by default, but can be turn…
authored
9 'enable_slimbox' => false,
a4ed814 @tlongren Add option to show wordpress query stats in the footer. Disabled by d…
authored
10 'show_query_stats' => false,
086b0e3 @tlongren Add option to display fuzzy timestamps.
authored
11 'fuzzy_timestamps' => false,
61966bf @tlongren Add "Maintenance Mode" option to allow admins to show the maintenance…
authored
12 'maintenance_mode' => false,
a22c9c4 @tlongren Add option for custom logo.
authored
13 'custom_logo_url' => '',
791ed95 @tlongren Add featured post slider and related theme options (ie: choose catego…
authored
14 'featured_image_size' => 'large',
f2dfcc7 @tlongren Add stylesheet chooser to options and include that stylesheet when lo…
authored
15 'theme_color' => 'pink',
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
16 'theme_font' => 'droid-serif',
791ed95 @tlongren Add featured post slider and related theme options (ie: choose catego…
authored
17 'featured_cat' => '',
41e9e43 @tlongren Add a "Custom CSS" field to the options page. This may get its own pa…
authored
18 'num_featured' => '5',
02b259e @tlongren Add option to only show post excerpts on the front page.
authored
19 'custom_css' => '',
20 'homepage_article_summary' => false
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
21 );
22
b2787d2 @tlongren Use wp_enqueue_scripts() to add styles instead of wp_print_styles(). …
authored
23 /**
24 * Returns the default options for HTML5Press
25 */
26 function html5press_get_default_options() {
27 return array(
28 'back_to_top' => true,
29 'show_tagline' => true,
30 'enable_slimbox' => false,
31 'show_query_stats' => false,
32 'fuzzy_timestamps' => false,
33 'maintenance_mode' => false,
34 'custom_logo_url' => '',
35 'featured_image_size' => 'large',
36 'theme_color' => 'pink',
37 'theme_font' => 'droid-serif',
38 'featured_cat' => '',
39 'num_featured' => '5',
40 'custom_css' => '',
41 'homepage_article_summary' => false
42 );
43 }
44
45 /**
46 * Returns the options array for HTML5Press.
47 */
48 function html5press_get_options() {
49 return get_option( 'html5press_options', html5press_get_default_options() );
50 }
51
52
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
53 if ( is_admin() ) : // Load only if we are viewing an admin page
54
55 function html5press_register_settings() {
56 // Register settings and call sanitation functions
57 register_setting( 'html5press_theme_options', 'html5press_options', 'html5press_validate_options' );
256ad86 @tlongren Add initial theme options page. Mostly to enable/disable the "back to…
authored
58 }
59
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
60 add_action( 'admin_init', 'html5press_register_settings' );
61
d97ab85 @tlongren Add option to set size of image that's linked to from featured images.
authored
62 // Store image sizes in array
63 $html5press_image_sizes = array(
64 'full' => array(
65 'value' => 'full',
66 'label' => 'Full'
67 ),
68 'large' => array(
69 'value' => 'large',
70 'label' => 'Large'
71 ),
72 'medium' => array(
73 'value' => 'medium',
74 'label' => 'Medium'
75 ),
76 'thumbnail' => array(
77 'value' => 'thumbnail',
78 'label' => 'Thumbnail'
79 )
80 );
81
791ed95 @tlongren Add featured post slider and related theme options (ie: choose catego…
authored
82 // Store categories in array
83 $html5press_categories[0] = array(
84 'value' => 0,
85 'label' => ''
86 );
87 $html5press_cats = get_categories(); $i = 1;
88 foreach( $html5press_cats as $html5press_cat ) :
89 $html5press_categories[$html5press_cat->cat_ID] = array(
90 'value' => $html5press_cat->cat_ID,
91 'label' => $html5press_cat->cat_name
92 );
93 $i++;
94 endforeach;
57f0b62 @tlongren Allow users to use all categories in the featured post slider instead…
authored
95 $html5press_categories[10000] = array(
96 'value' => 10000,
97 'label' => 'All Categories'
98 );
791ed95 @tlongren Add featured post slider and related theme options (ie: choose catego…
authored
99
100 // Store number of featured posts to show options
101 $html5press_num_featured_options = array(
369cf58 @tlongren Fix issue #8, courtesy of adeptris (http://profiles.wordpress.org/use…
authored
102 '5' => array(
791ed95 @tlongren Add featured post slider and related theme options (ie: choose catego…
authored
103 'value' => '5',
104 'label' => '5'
105 ),
369cf58 @tlongren Fix issue #8, courtesy of adeptris (http://profiles.wordpress.org/use…
authored
106 '10' => array(
791ed95 @tlongren Add featured post slider and related theme options (ie: choose catego…
authored
107 'value' => '10',
108 'label' => '10'
109 ),
369cf58 @tlongren Fix issue #8, courtesy of adeptris (http://profiles.wordpress.org/use…
authored
110 '15' => array(
791ed95 @tlongren Add featured post slider and related theme options (ie: choose catego…
authored
111 'value' => '15',
112 'label' => '15'
113 ),
369cf58 @tlongren Fix issue #8, courtesy of adeptris (http://profiles.wordpress.org/use…
authored
114 '20' => array(
791ed95 @tlongren Add featured post slider and related theme options (ie: choose catego…
authored
115 'value' => '20',
116 'label' => '20'
117 )
118 );
119
f2dfcc7 @tlongren Add stylesheet chooser to options and include that stylesheet when lo…
authored
120 // Store stylesheet choices in an array
121 $html5press_theme_colors = array(
122 'pink' => array(
123 'value' => 'pink',
124 'label' => 'Pink'
125 ),
2224ba2 @tlongren Update order of color schemes.
authored
126 'black' => array(
127 'value' => 'black',
128 'label' => 'Black'
129 ),
130 'blue' => array(
131 'value' => 'blue',
132 'label' => 'Blue'
133 ),
0e0efae @tlongren Rename the old blue color scheme to "bluish purple" and add another c…
authored
134 'bluishpurple' => array(
135 'value' => 'bluishpurple',
136 'label' => 'Bluish Purple'
f2dfcc7 @tlongren Add stylesheet chooser to options and include that stylesheet when lo…
authored
137 ),
138 'green' => array(
139 'value' => 'green',
140 'label' => 'Green'
141 ),
4ac95dd @tlongren Add light blue, orange, and yellow color options.
authored
142 'orange' => array(
143 'value' => 'orange',
144 'label' => 'Orange'
0e0efae @tlongren Rename the old blue color scheme to "bluish purple" and add another c…
authored
145 ),
2224ba2 @tlongren Update order of color schemes.
authored
146 'red' => array(
147 'value' => 'red',
148 'label' => 'Red'
149 )
f2dfcc7 @tlongren Add stylesheet chooser to options and include that stylesheet when lo…
authored
150 );
151
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
152 // Store font choices in an array
153 $html5press_theme_fonts = array(
154 'droid-serif' => array(
155 'value' => 'droid-serif',
156 'label' => 'Droid Serif'
157 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
158 'abel' => array(
159 'value' => 'abel',
160 'label' => 'Abel'
161 ),
162 'aclonica' => array(
163 'value' => 'aclonica',
164 'label' => 'Aclonica'
165 ),
166 'allerta' => array(
167 'value' => 'allerta',
168 'label' => 'Allerta'
169 ),
170 'amaranth' => array(
171 'value' => 'amaranth',
172 'label' => 'Amaranth'
173 ),
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
174 'antic' => array(
175 'value' => 'antic',
176 'label' => 'Antic'
177 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
178 'architects-daughter' => array(
179 'value' => 'architects-daughter',
180 'label' => 'Architects Daughter'
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
181 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
182 'cabin' => array(
183 'value' => 'cabin',
184 'label' => 'Cabin'
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
185 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
186 'calligraffitti' => array(
187 'value' => 'calligraffitti',
188 'label' => 'Calligraffitti'
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
189 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
190 'carter-one' => array(
191 'value' => 'carter-one',
192 'label' => 'Carter One'
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
193 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
194 'cherry-cream-soda' => array(
195 'value' => 'cherry-cream-soda',
196 'label' => 'Cherry Cream Soda'
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
197 ),
198 'comfortaa' => array(
199 'value' => 'comfortaa',
200 'label' => 'Comfortaa'
201 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
202 'coming-soon' => array(
203 'value' => 'coming-soon',
204 'label' => 'Coming Soon'
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
205 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
206 'days-one' => array(
207 'value' => 'days-one',
208 'label' => 'Days One'
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
209 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
210 'give-you-glory' => array(
211 'value' => 'give-you-glory',
212 'label' => 'Give You Glory'
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
213 ),
214 'gloria-hallelujah' => array(
215 'value' => 'gloria-hallelujah',
216 'label' => 'Gloria Hallelujah'
217 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
218 'hammersmith-one' => array(
219 'value' => 'hammersmith-one',
220 'label' => 'Hammersmith One'
221 ),
222 'im-fell-great-primer-sc' => array(
223 'value' => 'im-fell-great-primer-sc',
224 'label' => 'IM Fell Great Primer SC'
225 ),
226 'istok-web' => array(
227 'value' => 'istok-web',
228 'label' => 'Istok Web'
229 ),
230 'julee' => array(
231 'value' => 'julee',
232 'label' => 'Julee'
233 ),
234 'jura' => array(
235 'value' => 'jura',
236 'label' => 'Jura'
237 ),
238 'just-another-hand' => array(
239 'value' => 'just-another-hand',
240 'label' => 'Just Another Hand'
241 ),
242 'lobster-two' => array(
243 'value' => 'lobster-two',
244 'label' => 'Lobster Two'
245 ),
246 'neucha' => array(
247 'value' => 'neucha',
248 'label' => 'Neucha'
249 ),
250 'news-cycle' => array(
251 'value' => 'news-cycle',
252 'label' => 'News Cycle'
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
253 ),
254 'nothing-you-could-do' => array(
255 'value' => 'nothing-you-could-do',
256 'label' => 'Nothing You Could Do'
257 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
258 'numans' => array(
259 'value' => 'numans',
260 'label' => 'Numans'
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
261 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
262 'nunito' => array(
263 'value' => 'nunito',
264 'label' => 'Nunito'
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
265 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
266 'patrick-hand' => array(
267 'value' => 'patrick-hand',
268 'label' => 'Patrick Hand'
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
269 ),
270 'pt-sans-narrow' => array(
271 'value' => 'pt-sans-narrow',
272 'label' => 'PT Sans Narrow'
273 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
274 'quattrocento-sans' => array(
275 'value' => 'quattrocento-sans',
276 'label' => 'Quattrocento Sans'
277 ),
278 'questrial' => array(
279 'value' => 'questrial',
280 'label' => 'Questrial'
281 ),
282 'rationale' => array(
283 'value' => 'rationale',
284 'label' => 'Rationale'
285 ),
286 'redressed' => array(
287 'value' => 'redressed',
288 'label' => 'Redressed'
289 ),
290 'reenie-beanie' => array(
291 'value' => 'reenie-beanie',
292 'label' => 'Reenie Beanie'
293 ),
294 'rochester' => array(
295 'value' => 'rochester',
296 'label' => 'Rochester'
297 ),
298 'rock-salt' => array(
299 'value' => 'rock-salt',
300 'label' => 'Rock Salt'
301 ),
302 'short-stack' => array(
303 'value' => 'short-stack',
304 'label' => 'Short Stack'
305 ),
306 'smythe' => array(
307 'value' => 'smythe',
308 'label' => 'Smythe'
309 ),
310 'sue-ellen-francisco' => array(
311 'value' => 'sue-ellen-francisco',
312 'label' => 'Sue Ellen Francisco'
313 ),
02504df @tlongren Add Terminal Dosis google web font.
authored
314 'terminal-dosis' => array(
315 'value' => 'terminal-dosis',
316 'label' => 'Terminal Dosis'
317 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
318 'varela-round' => array(
319 'value' => 'varela-round',
320 'label' => 'Varela Round'
321 ),
322 'vibur' => array(
323 'value' => 'vibur',
324 'label' => 'Vibur'
325 ),
326 'volkhov' => array(
327 'value' => 'volkhov',
328 'label' => 'Volkhov'
329 ),
330 'voltaire' => array(
331 'value' => 'voltaire',
332 'label' => 'Voltaire'
333 ),
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
334 'walter-turncoat' => array(
335 'value' => 'walter-turncoat',
336 'label' => 'Walter Turncoat'
337 ),
c9d81d4 @tlongren Add 25 more Google Web Fonts.
authored
338 'yellowtail' => array(
339 'value' => 'yellowtail',
340 'label' => 'Yellowtail'
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
341 )
342 );
343
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
344 function html5press_theme_options() {
345 // Add theme options page to the addmin menu
846370c @tlongren Use get_template_directory_uri() instead of get_stylesheet_directory_…
authored
346 add_menu_page( 'HTML5Press', 'HTML5Press', 'edit_theme_options', 'theme_options', 'html5press_theme_options_page',get_template_directory_uri() . '/images/html5.png' );
751c45b @tlongren Give HTML5Press it's own top level menu in the dashboard and also on …
authored
347 add_submenu_page( 'theme_options', 'HTML5Press Notes', 'Notes', 'edit_theme_options', 'theme_options_notes', 'html5press_theme_notes_page');
256ad86 @tlongren Add initial theme options page. Mostly to enable/disable the "back to…
authored
348 }
349
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
350 add_action( 'admin_menu', 'html5press_theme_options' );
351
751c45b @tlongren Give HTML5Press it's own top level menu in the dashboard and also on …
authored
352 // Function for notes page
353 function html5press_theme_notes_page() {
354 echo '<div class="wrap">';
355 screen_icon();
356 echo '<h2>HTML5Press Notes</h2><ol>
357 <li><strong>Archive Page:</strong> There\'s a page template called Archives. Don\'t enter any page content, just title the page and select Archives for the page template. The archives will be generated automatically. See <a href="http://html5press.com/archives/">here for an example</a>.</li>
358 <li><strong>Link Post Format:</strong> To utilize the link Post Format, simply write a new post and select "Link" for the format. You\'ll also need to add a custom field with the URL you want to link to. The custom field name should be LinkFormatURL and the custom field value should be the URL you want to link to.</li>
359 <li><strong>Quote Post Format:</strong> When using this post format, I usually use the author or source as the post title, and then put the quote inside a blockquote for the actual post content.</li>
360 <li><strong>Status Post Format:</strong> Just put your status as the post title and publish (make sure you select the status format!). No post content is necessary.</li>
361 <li><strong>Maintenance Mode:</strong> This option lets you show a "maintenance" message to visitors who aren\'t logged in. This can be useful while making changes to your website or while tinkering with HTML5Press. Just don\'t forget to disable it when you\'re done or your visitors won\'t see your site!</li>
2da1d06 @tlongren Explain fuzzy timestamps and the twitter widget in HTML5Press notes, …
authored
362 <li><strong>Fuzzy Timestamps:</strong> Enabling fuzzy timestamps on the options page will cause dates/times to display like "two days ago" or "4 hours ago", instead of dates showing "10/07/2011 11:23:34".</li>
363 <li><strong>Twitter Widget:</strong> A custom twitter widget is included with HTML5Press as of version 2.1. This widget is based on the <a href="https://github.com/matthiassiegel/Simple-Twitter-Widget" target="_blank">Simple Twitter Widget</a> by <a href="http://chipsandtv.com" target="_blank">Matthias Siegel</a>. Matthias graciously allowed me to include his code in HTML5Press.</li>
751c45b @tlongren Give HTML5Press it's own top level menu in the dashboard and also on …
authored
364 </ol></div>';
365 }
366
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
367 // Function to generate options page
368 function html5press_theme_options_page() {
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
369 global $html5press_options, $html5press_image_sizes, $html5press_categories, $html5press_num_featured_options, $html5press_theme_colors, $html5press_theme_fonts;
256ad86 @tlongren Add initial theme options page. Mostly to enable/disable the "back to…
authored
370
371 if ( ! isset( $_REQUEST['settings-updated'] ) )
d97ab85 @tlongren Add option to set size of image that's linked to from featured images.
authored
372 $_REQUEST['settings-updated'] = false; ?>
256ad86 @tlongren Add initial theme options page. Mostly to enable/disable the "back to…
authored
373
374 <div class="wrap">
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
375
e0bcaa0 @tlongren Add missing text domain.
authored
376 <?php screen_icon(); echo "<h2>" . get_current_theme() . __( ' Theme Options','html5press' ) . "</h2>"; ?>
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
377
378 <?php if ( false !== $_REQUEST['settings-updated'] ) : ?>
379 <div class="updated fade"><p><strong><?php _e( 'Options saved', 'html5press' ); ?></strong></p></div>
380 <?php endif; ?>
381
382 <form method="post" action="options.php">
383
384 <?php $settings = get_option( 'html5press_options', $html5press_options ); ?>
385
386 <?php settings_fields( 'html5press_theme_options' ); ?>
387
388 <table class="form-table">
389
cc3372e @tlongren Add missing label.
authored
390 <tr valign="top"><th scope="row"><label for="back_to_top">"Back to Top" Button</label></th>
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
391 <td>
392 <input type="checkbox" id="back_to_top" name="html5press_options[back_to_top]" value="1" <?php checked( true, $settings['back_to_top'] ); ?> />
393 <label for="back_to_top">Enabled</label>
394 </td>
395 </tr>
f033f6d @tlongren Add option for infinite scrolling!
authored
396 <tr valign="top"><th scope="row"><label for="infinite_scroll">Infinite Scrolling</label></th>
397 <td>
398 <input type="checkbox" id="infinite_scroll" name="html5press_options[infinite_scroll]" value="1" <?php checked( true, $settings['infinite_scroll'] ); ?> />
399 <label for="infinite_scroll">Enabled</label>
400 </td>
401 </tr>
87a8a2d @tlongren Add option to disable the tagline from showing in the header.
authored
402 <tr valign="top"><th scope="row"><label for="show_tagline">Show Tagline In Header</label></th>
403 <td>
404 <input type="checkbox" id="show_tagline" name="html5press_options[show_tagline]" value="1" <?php checked( true, $settings['show_tagline'] ); ?> />
405 <label for="show_tagline">Enabled</label>
406 </td>
407 </tr>
acc2e69 @tlongren Add slimbox2 to HTML5Press. It's disabled by default, but can be turn…
authored
408 <tr valign="top"><th scope="row"><label for="enable_slimbox">Slimbox2 Image Overlay</label></th>
409 <td>
410 <input type="checkbox" id="enable_slimbox" name="html5press_options[enable_slimbox]" value="1" <?php checked( true, $settings['enable_slimbox'] ); ?> />
411 <label for="enable_slimbox">Enabled</label>
412 </td>
413 </tr>
a4ed814 @tlongren Add option to show wordpress query stats in the footer. Disabled by d…
authored
414 <tr valign="top"><th scope="row"><label for="show_query_stats">Show Query Stats In Footer</label></th>
415 <td>
416 <input type="checkbox" id="show_query_stats" name="html5press_options[show_query_stats]" value="1" <?php checked( true, $settings['show_query_stats'] ); ?> />
417 <label for="show_query_stats">Enabled</label>
418 </td>
419 </tr>
086b0e3 @tlongren Add option to display fuzzy timestamps.
authored
420 <tr valign="top"><th scope="row"><label for="fuzzy_timestamps">Fuzzy Timestamps</label></th>
421 <td>
422 <input type="checkbox" id="fuzzy_timestamps" name="html5press_options[fuzzy_timestamps]" value="1" <?php checked( true, $settings['fuzzy_timestamps'] ); ?> />
423 <label for="fuzzy_timestamps">Enabled</label>
424 </td>
425 </tr>
02b259e @tlongren Add option to only show post excerpts on the front page.
authored
426 <tr valign="top"><th scope="row"><label for="homepage_article_summary">Article Summaries on Home Page</label></th>
427 <td>
428 <input type="checkbox" id="homepage_article_summary" name="html5press_options[homepage_article_summary]" value="1" <?php checked( true, $settings['homepage_article_summary'] ); ?> />
429 <label for="homepage_article_summary">Enabled</label>
430 </td>
431 </tr>
acc2e69 @tlongren Add slimbox2 to HTML5Press. It's disabled by default, but can be turn…
authored
432 <tr valign="top"><th scope="row"><label for="maintenance_mode">Maintenance Mode</label></th>
61966bf @tlongren Add "Maintenance Mode" option to allow admins to show the maintenance…
authored
433 <td>
434 <input type="checkbox" id="maintenance_mode" name="html5press_options[maintenance_mode]" value="1" <?php checked( true, $settings['maintenance_mode'] ); ?> />
435 <label for="maintenance_mode">Enabled</label>
436 </td>
437 </tr>
a22c9c4 @tlongren Add option for custom logo.
authored
438 <tr valign="top"><th scope="row"><label for="custom_logo_url">Custom Logo URL</label></th>
439 <td>
440 <input type="text" id="custom_logo_url" name="html5press_options[custom_logo_url]" value="<?php echo esc_attr($settings['custom_logo_url']); ?>" />
441 </td>
442 </tr>
d97ab85 @tlongren Add option to set size of image that's linked to from featured images.
authored
443 <tr valign="top"><th scope="row"><label for="featured_image_size">Linked Featured Image Size</label></th>
444 <td>
445 <select id="featured_image_size" name="html5press_options[featured_image_size]">
446 <?php
447 foreach ( $html5press_image_sizes as $images ) :
448 $label = $images['label'];
449 $selected = '';
450 if ( $images['value'] == $settings['featured_image_size'] )
451 $selected = 'selected="selected"';
452 echo '<option style="padding-right: 10px;" value="' . esc_attr( $images['value'] ) . '" ' . $selected . '>' . $label . '</option>';
453 endforeach;
454 ?>
455 </select>
456 </td>
457 </tr>
f2dfcc7 @tlongren Add stylesheet chooser to options and include that stylesheet when lo…
authored
458 <tr valign="top"><th scope="row"><label for="theme_color">Theme Color</label></th>
459 <td>
460 <select id="theme_color" name="html5press_options[theme_color]">
461 <?php
462 foreach ( $html5press_theme_colors as $colors ) :
463 $label = $colors['label'];
464 $selected = '';
465 if ( $colors['value'] == $settings['theme_color'] )
466 $selected = 'selected="selected"';
467 echo '<option style="padding-right: 10px;" value="' . esc_attr( $colors['value'] ) . '" ' . $selected . '>' . $label . '</option>';
468 endforeach;
469 ?>
470 </select>
471 </td>
472 </tr>
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
473 <tr valign="top"><th scope="row"><label for="theme_font">Theme Font</label></th>
474 <td>
475 <select id="theme_font" name="html5press_options[theme_font]">
476 <?php
477 foreach ( $html5press_theme_fonts as $fonts ) :
478 $label = $fonts['label'];
479 $selected = '';
480 if ( $fonts['value'] == $settings['theme_font'] )
481 $selected = 'selected="selected"';
482 echo '<option style="padding-right: 10px;" value="' . esc_attr( $fonts['value'] ) . '" ' . $selected . '>' . $label . '</option>';
483 endforeach;
484 ?>
485 </select>
486 </td>
487 </tr>
a49fa48 @tlongren Update label for featured category.
authored
488 <tr valign="top"><th scope="row"><label for="featured_cat">Featured Post Category</label></th>
791ed95 @tlongren Add featured post slider and related theme options (ie: choose catego…
authored
489 <td>
490 <select id="featured_cat" name="html5press_options[featured_cat]">
491 <?php
492 foreach ( $html5press_categories as $category ) :
493 $label = $category['label'];
494 $selected = '';
495 if ( $category['value'] == $settings['featured_cat'] )
496 $selected = 'selected="selected"';
497 echo '<option style="padding-right: 10px;" value="' . esc_attr( $category['value'] ) . '" ' . $selected . '>' . $label . '</option>';
498 endforeach;
499 ?>
500 </select>
501 </td>
502 </tr>
503 <tr valign="top"><th scope="row"><label for="num_featured"># Featured Posts to Show</label></th>
504 <td>
505 <select id="num_featured" name="html5press_options[num_featured]">
506 <?php
507 foreach ( $html5press_num_featured_options as $featured ) :
508 $label = $featured['label'];
509 $selected = '';
510 if ( $featured['value'] == $settings['num_featured'] )
511 $selected = 'selected="selected"';
512 echo '<option style="padding-right: 10px;" value="' . esc_attr( $featured['value'] ) . '" ' . $selected . '>' . $label . '</option>';
513 endforeach;
514 ?>
515 </select>
516 </td>
517 </tr>
41e9e43 @tlongren Add a "Custom CSS" field to the options page. This may get its own pa…
authored
518 <tr valign="top"><th scope="row"><label for="custom_css">Custom CSS</label></th>
519 <td>
520 <textarea name="html5press_options[custom_css]" style="width:350px; height:200px;" cols="" rows=""><?php echo esc_attr($settings['custom_css']); ?></textarea>
521 </td>
522 </tr>
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
523 </table>
524
525 <p class="submit"><input type="submit" class="button-primary" value="Save Options" /></p>
526
527 </form>
528
256ad86 @tlongren Add initial theme options page. Mostly to enable/disable the "back to…
authored
529 </div>
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
530
256ad86 @tlongren Add initial theme options page. Mostly to enable/disable the "back to…
authored
531 <?php
532 }
533
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
534 function html5press_validate_options( $input ) {
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
535 global $html5press_options, $html5press_image_sizes, $html5press_categories, $html5press_num_featured_options, $html5press_theme_colors, $html5press_theme_fonts;
256ad86 @tlongren Add initial theme options page. Mostly to enable/disable the "back to…
authored
536
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
537 $settings = get_option( 'html5press_options', $html5press_options );
538
a22c9c4 @tlongren Add option for custom logo.
authored
539 $input['custom_logo_url'] = wp_filter_nohtml_kses( $input['custom_logo_url'] );
540
d97ab85 @tlongren Add option to set size of image that's linked to from featured images.
authored
541 // We select the previous value of the field, to restore it in case an invalid entry has been given
791ed95 @tlongren Add featured post slider and related theme options (ie: choose catego…
authored
542 $prev = $settings['featured_cat'];
543 // We verify if the given value exists in the categories array
544 if ( !array_key_exists( $input['featured_cat'], $html5press_categories ) )
545 $input['featured_cat'] = $prev;
546
547 // We select the previous value of the field, to restore it in case an invalid entry has been given
369cf58 @tlongren Fix issue #8, courtesy of adeptris (http://profiles.wordpress.org/use…
authored
548 $prev = $settings['num_featured'];
791ed95 @tlongren Add featured post slider and related theme options (ie: choose catego…
authored
549 // We verify if the given value exists in the categories array
369cf58 @tlongren Fix issue #8, courtesy of adeptris (http://profiles.wordpress.org/use…
authored
550 if ( !array_key_exists( $input['num_featured'], $html5press_num_featured_options ) )
551 $input['num_featured'] = $prev;
f2dfcc7 @tlongren Add stylesheet chooser to options and include that stylesheet when lo…
authored
552
553 // We select the previous value of the field, to restore it in case an invalid entry has been given
554 $prev = $settings['theme_color'];
555 if ( !array_key_exists( $input['theme_color'], $html5press_theme_colors ) )
556 $input['theme_color'] = $prev;
791ed95 @tlongren Add featured post slider and related theme options (ie: choose catego…
authored
557
558 // We select the previous value of the field, to restore it in case an invalid entry has been given
31fa13c @tlongren Added 20 fonts from the Google Font Directory. Fonts can be chosen fr…
authored
559 $prev = $settings['theme_font'];
560 if ( !array_key_exists( $input['theme_font'], $html5press_theme_fonts ) )
561 $input['theme_font'] = $prev;
562
563 // We select the previous value of the field, to restore it in case an invalid entry has been given
d97ab85 @tlongren Add option to set size of image that's linked to from featured images.
authored
564 $prev = $settings['featured_image_size'];
565 if ( !array_key_exists( $input['featured_image_size'], $html5press_image_sizes ) )
566 $input['featured_image_size'] = $prev;
567
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
568 // If the checkbox has not been checked, we void it
87a8a2d @tlongren Add option to disable the tagline from showing in the header.
authored
569 if ( ! isset( $input['show_tagline'] ) )
570 $input['show_tagline'] = null;
571 // We verify if the input is a boolean value
572 $input['show_tagline'] = ( $input['show_tagline'] == 1 ? 1 : 0 );
573
574 // If the checkbox has not been checked, we void it
acc2e69 @tlongren Add slimbox2 to HTML5Press. It's disabled by default, but can be turn…
authored
575 if ( ! isset( $input['enable_slimbox'] ) )
576 $input['enable_slimbox'] = null;
577 // We verify if the input is a boolean value
578 $input['enable_slimbox'] = ( $input['enable_slimbox'] == 1 ? 1 : 0 );
579
580 // If the checkbox has not been checked, we void it
a4ed814 @tlongren Add option to show wordpress query stats in the footer. Disabled by d…
authored
581 if ( ! isset( $input['show_query_stats'] ) )
582 $input['show_query_stats'] = null;
583 // We verify if the input is a boolean value
584 $input['show_query_stats'] = ( $input['show_query_stats'] == 1 ? 1 : 0 );
585
586 // If the checkbox has not been checked, we void it
086b0e3 @tlongren Add option to display fuzzy timestamps.
authored
587 if ( ! isset( $input['fuzzy_timestamps'] ) )
588 $input['fuzzy_timestamps'] = null;
589 // We verify if the input is a boolean value
590 $input['fuzzy_timestamps'] = ( $input['fuzzy_timestamps'] == 1 ? 1 : 0 );
591
02b259e @tlongren Add option to only show post excerpts on the front page.
authored
592 // If the checkbox has not been checked, we void it
593 if ( ! isset( $input['homepage_article_summary'] ) )
594 $input['homepage_article_summary'] = null;
595 // We verify if the input is a boolean value
596 $input['homepage_article_summary'] = ( $input['homepage_article_summary'] == 1 ? 1 : 0 );
086b0e3 @tlongren Add option to display fuzzy timestamps.
authored
597
598 // If the checkbox has not been checked, we void it
61966bf @tlongren Add "Maintenance Mode" option to allow admins to show the maintenance…
authored
599 if ( ! isset( $input['maintenance_mode'] ) )
600 $input['maintenance_mode'] = null;
601 // We verify if the input is a boolean value
602 $input['maintenance_mode'] = ( $input['maintenance_mode'] == 1 ? 1 : 0 );
603
604 // If the checkbox has not been checked, we void it
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
605 if ( ! isset( $input['back_to_top'] ) )
606 $input['back_to_top'] = null;
607 // We verify if the input is a boolean value
608 $input['back_to_top'] = ( $input['back_to_top'] == 1 ? 1 : 0 );
f033f6d @tlongren Add option for infinite scrolling!
authored
609
610 // If the checkbox has not been checked, we void it
611 if ( ! isset( $input['infinite_scroll'] ) )
612 $input['infinite_scroll'] = null;
613 // We verify if the input is a boolean value
614 $input['infinite_scroll'] = ( $input['infinite_scroll'] == 1 ? 1 : 0 );
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
615
256ad86 @tlongren Add initial theme options page. Mostly to enable/disable the "back to…
authored
616 return $input;
cf4b165 @tlongren Better options. Now turns the "back to top" button on by default.
authored
617 }
618
619 endif; // EndIf is_admin()
de09163 @tlongren Add a black color scheme to choose from.
authored
620 ?>
Something went wrong with that request. Please try again.