-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.php
executable file
·86 lines (72 loc) · 2.74 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
<?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 'madmousetheme'
* 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', 'madmousetheme'),
'type' => 'heading');
// Standard Meta
$options[] = array(
'name' => __('Head ID', 'madmousetheme'),
'desc' => __("", 'madmousetheme'),
'id' => 'meta_headid',
'std' => 'www-sitename-com',
'type' => 'text');
$options[] = array(
'name' => __('Google Webmaster Site Verification Content', 'madmousetheme'),
'desc' => __("See <a href='http://google.com/webmasters' target='_blank'>http://google.com/webmasters</a> for more information", 'madmousetheme'),
'id' => 'meta_google',
'std' => '',
'type' => 'text');
// Icons
$options[] = array(
'name' => __('Site Favicon', 'madmousetheme'),
'desc' => __('', 'madmousetheme'),
'id' => 'head_favicon',
'type' => 'upload');
$options[] = array(
'name' => __('Apple Touch Icon', 'madmousetheme'),
'desc' => __('', 'madmousetheme'),
'id' => 'head_apple_touch_icon',
'type' => 'upload');
return $options;
}