-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.php
More file actions
95 lines (80 loc) · 3.19 KB
/
options.php
File metadata and controls
95 lines (80 loc) · 3.19 KB
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
<?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)
$themename = get_option( 'stylesheet' );
$themename = preg_replace("/\W/", "_", strtolower($themename) );
$optionsframework_settings = get_option('optionsframework');
$optionsframework_settings['id'] = $themename;
update_option('optionsframework', $optionsframework_settings);
// echo $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.
*
*/
function optionsframework_options() {
// Pull all the pages into an array
$options_pages = array();
$options_pages_obj = get_pages('sort_column=post_parent,menu_order');
$options_pages[''] = 'Выбрать страницу:';
foreach ($options_pages_obj as $page) {
$options_pages[$page->ID] = $page->post_title;
}
$options = array();
$options[] = array(
'name' => __('Basic Settings', 'options_check'),
'type' => 'heading');
//
// $options[] = array(
// 'name' => __('Украинский текст заголовка', 'options_check'),
// 'id' => 'ua_header_text_page',
// 'type' => 'select',
// 'options' => $options_pages);
//
// $options[] = array(
// 'name' => __('Русский текст заголовка', 'options_check'),
// 'id' => 'ru_header_text_page',
// 'type' => 'select',
// 'options' => $options_pages);
//
// $options[] = array(
// 'name' => __('Английский текст заголовка', 'options_check'),
// 'id' => 'en_header_text_page',
// 'type' => 'select',
// 'options' => $options_pages);
/**
* For $settings options see:
* http://codex.wordpress.org/Function_Reference/wp_editor
*
* 'media_buttons' are not supported as there is no post to attach items to
* 'textarea_name' is set by the 'id' you choose
*/
$wp_editor_settings = array(
'wpautop' => true, // Default
'textarea_rows' => 5,
'tinymce' => array( 'plugins' => 'wordpress' )
);
$options[] = array(
'name' => __('Украинский текст заголовка', 'options_check'),
'id' => 'ua_header_text_page',
'type' => 'editor',
'settings' => $wp_editor_settings );
$options[] = array(
'name' => __('Русский текст заголовка', 'options_check'),
'id' => 'ru_header_text_page',
'type' => 'editor',
'settings' => $wp_editor_settings );
$options[] = array(
'name' => __('Английский текст заголовка', 'options_check'),
'id' => 'en_header_text_page',
'type' => 'editor',
'settings' => $wp_editor_settings );
return $options;
}