1
|
1 |
<?php |
|
2 |
$themename = "SWT Theme"; |
|
3 |
$shortname = "swt"; |
|
4 |
$mx_categories_obj = get_categories('hide_empty=0'); |
|
5 |
$mx_categories = array(); |
|
6 |
foreach ($mx_categories_obj as $mx_cat) { |
|
7 |
$mx_categories[$mx_cat->cat_ID] = $mx_cat->cat_name; |
|
8 |
} |
|
9 |
$categories_tmp = array_unshift($mx_categories, "Select a category:","Uncategorized" ); |
|
10 |
$number_entries = array("Select a Number:","1","2","3","4","5","6","7","8","9","10", "12","14", "16", "18", "20" ); |
|
11 |
$options = array ( |
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
array( "name" => "Featured Panel Settings", |
|
17 |
"type" => "heading", |
|
18 |
"desc" => "This section customizes the sliding panel area and the number of panels to be displayed.", |
|
19 |
), |
|
20 |
|
|
21 |
array( "name" => "Featured Panel category", |
|
22 |
"desc" => "Select the category that you would like to have displayed on the sliding.", |
|
23 |
"id" => $shortname."_slide_category", |
|
24 |
"std" => "Uncategorized", |
|
25 |
"type" => "select", |
|
26 |
"options" => $mx_categories), |
|
27 |
|
|
28 |
array( "name" => "Number of sliding panels", |
|
29 |
"desc" => "Select the number of panels to display .", |
|
30 |
"id" => $shortname."_slide_count", |
|
31 |
"std" => "1", |
|
32 |
"type" => "select", |
|
33 |
"options" => $number_entries), |
|
34 |
|
|
35 |
array( "name" => "Enable/Disable Featured Categories", |
|
36 |
"id" => $shortname."_fcats", |
|
37 |
"type" => "select", |
|
38 |
"std" => "Display", |
|
39 |
"options" => array("Display", "Hide")), |
|
40 |
|
|
41 |
array( "name" => "Choose Which <strong>Category</strong> To Feature On 1st Block?", |
|
42 |
"id" => $shortname."_bluzon_featured_category1", |
|
43 |
"type" => "select", |
|
44 |
"std" => "Select A Category", |
|
45 |
"options" => $mx_categories), |
|
46 |
|
|
47 |
array( "name" => "Choose How Many <strong>Post</strong> To Display On 1st Block?", |
|
48 |
"id" => $shortname."_bluzon_featured_number1", |
|
49 |
"type" => "select", |
|
50 |
"std" => "Select A Number", |
|
51 |
"options" => $number_entries), |
|
52 |
|
|
53 |
array( "name" => "Header banner Image", |
|
54 |
"desc" => "Enter your 468 x 60 banner image url here.", |
|
55 |
"id" => $shortname."_hbanner", |
|
56 |
"std" => "Header banner Image", |
|
57 |
"type" => "text"), |
|
58 |
|
|
59 |
array("name" => "Header banner Url", |
|
60 |
"desc" => "Enter the header banner url here.", |
|
61 |
"id" => $shortname."_hlink", |
|
62 |
"std" => "Header banner url", |
|
63 |
"type" => "text"), |
|
64 |
|
|
65 |
array( "name" => "125 x 125 banner Settings", |
|
66 |
"type" => "heading", |
|
67 |
), |
|
68 |
|
|
69 |
array("name" => "Banner-1 Image", |
|
70 |
"desc" => "Enter your 125x125 banner image url here.", |
|
71 |
"id" => $shortname."_banner1", |
|
72 |
"std" => "Banner-1 image", |
|
73 |
"type" => "text"), |
|
74 |
|
|
75 |
array("name" => "Banner-1 Url", |
|
76 |
"desc" => "Enter the banner-1 url here.", |
|
77 |
"id" => $shortname."_link1", |
|
78 |
"std" => "Banner-1 url", |
|
79 |
"type" => "text"), |
|
80 |
|
|
81 |
array("name" => "Banner-2 Image", |
|
82 |
"desc" => "Enter your 125x125 banner image url here.", |
|
83 |
"id" => $shortname."_banner2", |
|
84 |
"std" => "Banner-2 image", |
|
85 |
"type" => "text"), |
|
86 |
|
|
87 |
array("name" => "Banner-2 Url", |
|
88 |
"desc" => "Enter the banner-2 url here.", |
|
89 |
"id" => $shortname."_link2", |
|
90 |
"std" => "Banner-2 url", |
|
91 |
"type" => "text"), |
|
92 |
|
|
93 |
array("name" => "Banner-3 Image", |
|
94 |
"desc" => "Enter your 125x125 banner image url here.", |
|
95 |
"id" => $shortname."_banner3", |
|
96 |
"std" => "Banner-3 image", |
|
97 |
"type" => "text"), |
|
98 |
|
|
99 |
array("name" => "Banner-3 Url", |
|
100 |
"desc" => "Enter the banner-3 url here.", |
|
101 |
"id" => $shortname."_link3", |
|
102 |
"std" => "Banner-3 url", |
|
103 |
"type" => "text"), |
|
104 |
|
|
105 |
array("name" => "Banner-4 Image", |
|
106 |
"desc" => "Enter your 125x125 banner image url here.", |
|
107 |
"id" => $shortname."_banner4", |
|
108 |
"std" => "Banner-4 image", |
|
109 |
"type" => "text"), |
|
110 |
|
|
111 |
array("name" => "Banner-4 Url", |
|
112 |
"desc" => "Enter the banner-4 url here.", |
|
113 |
"id" => $shortname."_link4", |
|
114 |
"std" => "Banner-4 url", |
|
115 |
"type" => "text"), |
|
116 |
|
|
117 |
array("name" => "Twitter url", |
|
118 |
"desc" => "Twitter url here.", |
|
119 |
"id" => $shortname."_twitt", |
|
120 |
"std" => "#", |
|
121 |
"type" => "text"), |
|
122 |
|
|
123 |
array("name" => "Rss url", |
|
124 |
"desc" => "Rss url here.", |
|
125 |
"id" => $shortname."_rss", |
|
126 |
"std" => "#", |
|
127 |
"type" => "text"), |
|
128 |
|
|
129 |
array("name" => "Email", |
|
130 |
"desc" => "Email here.", |
|
131 |
"id" => $shortname."_email", |
|
132 |
"std" => "#", |
|
133 |
"type" => "text"), |
|
134 |
|
|
135 |
array( "name" => "Enable/Disable social bookmark", |
|
136 |
"id" => $shortname."_social", |
|
137 |
"type" => "select", |
|
138 |
"std" => "Display", |
|
139 |
"options" => array("Display", "Hide")), |
|
140 |
|
|
141 |
array( "name" => "Enable/Disable Follow us", |
|
142 |
"id" => $shortname."_follow", |
|
143 |
"type" => "select", |
|
144 |
"std" => "Display", |
|
145 |
"options" => array("Display", "Hide")), |
|
146 |
|
|
147 |
array( "name" => "Enable/Disable top banner 468x165", |
|
148 |
"id" => $shortname."_topbanner", |
|
149 |
"type" => "select", |
|
150 |
"std" => "Display", |
|
151 |
"options" => array("Display", "Hide")), |
|
152 |
|
|
153 |
array( "name" => "Enable/Disable 125x125 banners", |
|
154 |
"id" => $shortname."_banners", |
|
155 |
"type" => "select", |
|
156 |
"std" => "Display", |
|
157 |
"options" => array("Display", "Hide")), |
|
158 |
|
|
159 |
array( "name" => "Exclude pages", |
|
160 |
"desc" => "You can exclude some of the links in the pages menu (comma separated!).", |
|
161 |
"id" => $shortname."_pages", |
|
162 |
"std" => "", |
|
163 |
"type" => "text"), |
|
164 |
|
|
165 |
array( "name" => "Exclude categories", |
|
166 |
"desc" => "You can exclude some of the links in the categories menu (comma separated!).", |
|
167 |
"id" => $shortname."_categories", |
|
168 |
"std" => "", |
|
169 |
"type" => "text"), |
|
170 |
|
|
171 |
array( "name" => "Enable/Disable About Us", |
|
172 |
"id" => $shortname."_aboutcheck", |
|
173 |
"type" => "select", |
|
174 |
"std" => "Display", |
|
175 |
"options" => array("Display", "Hide")), |
|
176 |
|
|
177 |
array( "name" => "About Us Text", |
|
178 |
"id" => $shortname."_aboutus", |
|
179 |
"std" => "", |
|
180 |
"type" => "textarea"), |
|
181 |
|
|
182 |
array( "name" => "About Us Image", |
|
183 |
"id" => $shortname."_about_image", |
|
184 |
"std" => "", |
|
185 |
"type" => "text"), |
|
186 |
|
|
187 |
); |
|
188 |
|
|
189 |
function mytheme_add_admin() { |
|
190 |
|
|
191 |
global $themename, $shortname, $options; |
|
192 |
|
|
193 |
if ( $_GET['page'] == basename(__FILE__) ) { |
|
194 |
|
|
195 |
if ( 'save' == $_REQUEST['action'] ) { |
|
196 |
|
|
197 |
foreach ($options as $value) { |
|
198 |
update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } |
|
199 |
|
|
200 |
foreach ($options as $value) { |
|
201 |
if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } } |
|
202 |
|
|
203 |
header("Location: themes.php?page=themeoptions.php&saved=true"); |
|
204 |
die; |
|
205 |
|
|
206 |
} else if( 'reset' == $_REQUEST['action'] ) { |
|
207 |
|
|
208 |
foreach ($options as $value) { |
|
209 |
delete_option( $value['id'] ); |
|
210 |
update_option( $value['id'], $value['std'] );} |
|
211 |
|
|
212 |
header("Location: themes.php?page=themeoptions.php&reset=true"); |
|
213 |
die; |
|
214 |
|
|
215 |
} |
|
216 |
} |
|
217 |
|
|
218 |
add_theme_page($themename." Options", "$themename Options", 'edit_themes', basename(__FILE__), 'mytheme_admin'); |
|
219 |
|
|
220 |
} |
|
221 |
|
|
222 |
function mytheme_admin() { |
|
223 |
|
|
224 |
global $themename, $shortname, $options; |
|
225 |
|
|
226 |
if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings saved.</strong></p></div>'; |
|
227 |
if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings reset.</strong></p></div>'; |
|
228 |
|
|
229 |
|
|
230 |
?> |
|
231 |
<div class="wrap"> |
|
232 |
<h2><b><?php echo $themename; ?> theme options</b></h2> |
|
233 |
|
|
234 |
<form method="post"> |
|
235 |
|
|
236 |
<table class="optiontable" > |
|
237 |
|
|
238 |
<?php foreach ($options as $value) { |
|
239 |
|
|
240 |
|
|
241 |
if ($value['type'] == "text") { ?> |
|
242 |
|
|
243 |
<tr align="left"> |
|
244 |
<th scope="row"><?php echo $value['name']; ?>:</th> |
|
245 |
<td> |
|
246 |
<input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" size="40" /> |
|
247 |
|
|
248 |
</td> |
|
249 |
|
|
250 |
</tr> |
|
251 |
<tr><td colspan=2> <small><?php echo $value['desc']; ?> </small> <hr /></td></tr> |
|
252 |
|
|
253 |
<?php } elseif ($value['type'] == "textarea") { ?> |
|
254 |
<tr align="left"> |
|
255 |
<th scope="row"><?php echo $value['name']; ?>:</th> |
|
256 |
<td> |
|
257 |
<textarea name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" cols="40" rows="5"/><?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?> |
|
258 |
</textarea> |
|
259 |
|
|
260 |
|
|
261 |
</td> |
|
262 |
|
|
263 |
</tr> |
|
264 |
<tr><td colspan=2> <small><?php echo $value['desc']; ?> </small> <hr /></td></tr> |
|
265 |
|
|
266 |
<?php } elseif ($value['type'] == "select") { ?> |
|
267 |
|
|
268 |
<tr align="left"> |
|
269 |
<th scope="top"><?php echo $value['name']; ?>:</th> |
|
270 |
<td> |
|
271 |
<select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>"> |
|
272 |
<?php foreach ($value['options'] as $option) { ?> |
|
273 |
<option<?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; }?>><?php echo $option; ?></option> |
|
274 |
<?php } ?> |
|
275 |
</select> |
|
276 |
|
|
277 |
</td> |
|
278 |
|
|
279 |
</tr> |
|
280 |
<tr><td colspan=2> <small><?php echo $value['desc']; ?> </small> <hr /></td></tr> |
|
281 |
|
|
282 |
|
|
283 |
|
|
284 |
<?php } elseif ($value['type'] == "heading") { ?> |
|
285 |
|
|
286 |
<tr valign="top"> |
|
287 |
<td colspan="2" style="text-align: left;"><h2 style="color:grey;"><?php echo $value['name']; ?></h2></td> |
|
288 |
</tr> |
|
289 |
<tr><td colspan=2> <small> <p style="color:blue; margin:0 0;" > <?php echo $value['desc']; ?> </P> </small> <hr /></td></tr> |
|
290 |
|
|
291 |
<?php } ?> |
|
292 |
<?php |
|
293 |
} |
|
294 |
?> |
|
295 |
</table> |
|
296 |
<p class="submit"> |
|
297 |
<input name="save" type="submit" value="Save changes" /> |
|
298 |
<input type="hidden" name="action" value="save" /> |
|
299 |
</p> |
|
300 |
</form> |
|
301 |
<form method="post"> |
|
302 |
<p class="submit"> |
|
303 |
<input name="reset" type="submit" value="Reset" /> |
|
304 |
<input type="hidden" name="action" value="reset" /> |
|
305 |
</p> |
|
306 |
</form> |
|
307 |
<h2>Preview (updated when options are saved)</h2> |
|
308 |
<iframe src="../?preview=true" width="100%" height="600" ></iframe> |
|
309 |
<p>For support related issues visit the <a href="http://dannci.com/" >dannci.com</a></p> |
|
310 |
<?php |
|
311 |
} |
|
312 |
add_action('admin_menu', 'mytheme_add_admin'); ?> |