-
Notifications
You must be signed in to change notification settings - Fork 229
/
index.php
executable file
·212 lines (175 loc) · 5.93 KB
/
index.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
<?php
/**
* The main template file.
*
* This theme is purely for the purpose of testing theme options in Options Framework plugin.
*
* @package WordPress
* @subpackage Options Framework Theme
*/
get_header(); ?>
<article>
<header class="entry-header">
<h1>Options Framework Theme</h1>
<p>Use of_get_option($id,$default) to return option values.</p>
</header><!-- .entry-header -->
<div class="entry-content">
<h3>About</h3>
<p>This is the adapted theme version of the Options Framework plugin, which makes it easy to include an options panel for any theme.</p>
<h3>How to Include in Your Own Project</h3>
<p>Just drag the admin folder of this theme, options.php and functions.php into the theme of your choice.</p>
<hr>
<h3>Basic Options</h3>
<dl>
<dt>type: text (mini)</dt>
<dd>of_get_option('example_text_mini'): <?php echo of_get_option( 'example_text_mini', 'no entry' ); ?></dd>
</dl>
<dl>
<dt>type: text</dt>
<dd>of_get_option('example_text'): <?php echo of_get_option( 'example_text', 'no entry' ); ?></dd>
</dl>
<dl>
<dt>type: textarea</dt>
<dd>of_get_option('example_textarea'): <?php echo of_get_option( 'example_textarea', 'no entry' ); ?></dd>
</dl>
<dl>
<dt>type: select (mini)</dt>
<dd>of_get_option('example_select'): <?php echo of_get_option( 'example_select', 'no entry' ); ?></dd>
</dl>
<dl>
<dt>type: select2 (wide)</dt>
<dd>of_get_option('example_select_wide'): <?php echo of_get_option( 'example_select_wide', 'no entry' ); ?></dd>
</dl>
<dl>
<dt>type: select</dt>
<dd>of_get_option('example_select_categories'): category id = <?php echo of_get_option( 'example_select_categories', 'no entry' ); ?></dd>
</dl>
<dl>
<dt>type: select</dt>
<dd>of_get_option('example_select_tags'): term id = <?php echo of_get_option( 'example_select_tags', 'no entry' ); ?></dd>
</dl>
<dl>
<dt>type: select</dt>
<dd>of_get_option('example_select_pages'): page id = <?php echo of_get_option( 'example_select_pages', 'no entry' ); ?></dd>
</dl>
<dl>
<dt>type: radio</dt>
<dd>of_get_option('example_radio'): <?php echo of_get_option( 'example_radio', 'no entry' ); ?></dd>
</dl>
<dl>
<dt>type: checkbox</dt>
<dd>of_get_option('example_checkbox'): <?php echo of_get_option( 'example_checkbox', 'no entry' ); ?></dd>
</dl>
<hr>
<h3>Advanced Options</h3>
<dl>
<dt>type: uploader</dt>
<dd>of_get_option('example_uploader'): <?php echo of_get_option( 'example_uploader', 'no entry' ); ?></dd>
<?php if ( of_get_option( 'example_uploader' ) ) { ?>
<img src="<?php echo of_get_option( 'example_uploader' ); ?>" />
<?php } ?>
</dl>
<dl>
<dt>type: image</dt>
<dd>of_get_option('images'): <?php echo of_get_option( 'example_images', 'no entry' ); ?></dd>
</dl>
<dl>
<dt>type: multicheck</dt>
<dd>of_get_option('multicheck'):
<?php $multicheck = of_get_option( 'example_multicheck', 'none' ); ?>
<?php print_r($multicheck); ?>
</dd>
</dl>
<p>The array sent in the options panel was defined as:<br>
<?php
$test_array_jr = array( "one" => "French Toast", "two" => "Pancake", "three" => "Omelette", "four" => "Crepe", "five" => "Waffle" );
print_r( $test_array_jr );
?>
</p>
<p>You can get the value of all items in the checkbox array:</p>
<ul>
<?php
if ( is_array( $multicheck ) ) {
foreach ( $multicheck as $key => $value ) {
// If you need the option's name rather than the key you can get that
$name = $test_array_jr[$key];
// Prints out each of the values
echo '<li>' . $key . ' (' . $name . ') = ' . $value . '</li>';
}
}
else {
echo '<li>There are no saved values yet.</li>';
}
?>
</ul>
<p>You can also get an individual checkbox value if you know what you are looking for. In this example, I'll check for the key "one", which is an item I sent in the array for checkboxes:</p>
<p>The value of the multicheck box "one" of example_multicheck is:
<b>
<?php
if ( isset( $multicheck['one'] ) ) {
echo $multicheck['one'];
} else {
echo 'no entry';
}
?>
</b>
</p>
<dl>
<dt>type: background</dt>
<dd>of_get_option('background'):
<?php $background = of_get_option('example_background');
if ( $background ) {
if ( $background['image'] ) {
echo '<span style="display: block; height: 200px; width: 200px; background:url(' . $background['image'] . ') "></span>';
echo '<ul>';
foreach ( $background as $i=> $param ){
echo '<li>'.$i . ' = ' . $param . '</li>';
}
echo '</ul>';
} else {
echo '<span style="display: inline-block; height: 20px; width: 20px; background:' . $background['color'] . ' "></span>';
echo '<ul>';
echo '<li>'.$background['color'].'</li>';
echo '</ul>';
}
} else {
echo "no entry";
}; ?>
</span>
</dd>
</dl>
<dl>
<dt>type: colorpicker</dt>
<dd>of_get_option('colorpicker'):
<span style="color:<?php echo of_get_option( 'example_colorpicker', '#000' ); ?>">
<?php echo of_get_option( 'example_colorpicker', 'no entry' ); ?>
</span>
</dd>
</dl>
<dl>
<dt>type: typography</dt>
<dd>of_get_option('typography'):
<?php $typography = of_get_option('example_typography');
if ( $typography ) {
echo '<ul>';
foreach ( $typography as $i => $param ) {
echo '<li>'.$i . ' = ' . $param . '</li>';
}
echo '</ul>';
echo '<span style="font-family: ' . $typography['face'] . '; font-size:' . $typography['size'] . '; font-style: ' . $typography['style'] . '; color:'.$typography['color'] . ';">Some sample text in your style</span>';
} else {
echo "no entry";
} ?>
</dd>
</dl>
<hr>
<h3>Editor</h3>
<dl>
<dt>type: editor</dt>
<dd>of_get_option('example_editor'):<br>
<?php echo of_get_option( 'example_editor', 'no entry'); ?>
</dd>
</dl>
</div><!-- .entry-content -->
</article><!-- #post-0 -->
<?php get_footer(); ?>