Dropdown Menu Widget - Version 1.2.7

Version Description

  • Added "include homepage link" for both pages and categories now. You can enable/disable this link from the widget options easily.
Download this release

Release Info

Developer mattsay
Plugin Icon wp plugin Dropdown Menu Widget
Version 1.2.7
Comparing to
See all releases

Code changes from version 1.2.6 to 1.2.7

Files changed (2) hide show
  1. readme.txt +4 -1
  2. shailan.DropDownMenu.php +24 -3
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://shailan.com/donate
4
  Tags: css, dropdown, menu, widget, pages, categories
5
  Requires at least: 2.5
6
  Tested up to: 2.9
7
- Stable tag: 1.2.6
8
 
9
  This widget adds a beatiful vertical/horizontal CSS only dropdown menu of pages OR categories of your blog.
10
 
@@ -47,6 +47,9 @@ You can submit errors and bugs using the [online form](http://shailan.com/contac
47
 
48
  == Changelog ==
49
 
 
 
 
50
  = 1.2.6 =
51
  * Fixed a minor bug.
52
 
4
  Tags: css, dropdown, menu, widget, pages, categories
5
  Requires at least: 2.5
6
  Tested up to: 2.9
7
+ Stable tag: 1.2.7
8
 
9
  This widget adds a beatiful vertical/horizontal CSS only dropdown menu of pages OR categories of your blog.
10
 
47
 
48
  == Changelog ==
49
 
50
+ = 1.2.7 =
51
+ * Added "include homepage link" for both pages and categories now. You can enable/disable this link from the widget options easily.
52
+
53
  = 1.2.6 =
54
  * Fixed a minor bug.
55
 
shailan.DropDownMenu.php CHANGED
@@ -3,13 +3,13 @@
3
  Plugin Name: Shailan Dropdown Menu Widget
4
  Plugin URI: http://shailan.com/wordpress/plugins/dropdown-menu
5
  Description: A multi widget to generate drop-down menus from your pages and categories. This widget is best used in <a href="http://shailan.com">Shailan.com</a> themes. You can find more widgets, plugins and themes at <a href="http://shailan.com">shailan.com</a>.
6
- Version: 1.2.6
7
  Author: Matt Say
8
  Author URI: http://shailan.com
9
  Text Domain: shailan-dropdown-menu
10
  */
11
 
12
- define('SHAILAN_DM_VERSION','1.2.6');
13
  define('SHAILAN_DM_TITLE', 'Dropdown Menu');
14
  define('SHAILAN_DM_FOLDER', 'dropdown-menu-widget');
15
 
@@ -42,6 +42,7 @@ class shailan_DropdownWidget extends WP_Widget {
42
  $type_tag = 'shailan_dm_type';
43
  $exclude_tag = 'shailan_dm_exclude';
44
  $inline_style_tag = 'shailan_dm_style';
 
45
  $login_tag = 'shailan_dm_login';
46
  $admin_tag = 'shailan_dm_admin';
47
  $vertical_tag = 'shailan_dm_vertical';
@@ -53,6 +54,7 @@ class shailan_DropdownWidget extends WP_Widget {
53
  $type = get_option($type_tag);
54
  $exclude = get_option($exclude_tag);
55
  $inline_style = get_option($inline_style_tag);
 
56
  $login = (bool) get_option($login_tag);
57
  $admin = (bool) get_option($admin_tag);
58
  $vertical = (bool) get_option($vertical_tag);
@@ -65,6 +67,7 @@ class shailan_DropdownWidget extends WP_Widget {
65
  $type = $_POST[$type_tag];
66
  $exclude = $_POST[$exclude_tag];
67
  $inline_style = $_POST[$inline_style_tag];
 
68
  $login = (bool) $_POST[$login_tag];
69
  $admin = (bool) $_POST[$admin_tag];
70
  $vertical = (bool) $_POST[$vertical_tag];
@@ -74,6 +77,7 @@ class shailan_DropdownWidget extends WP_Widget {
74
  update_option($type_tag, $type);
75
  update_option($exclude_tag, $exclude);
76
  update_option($inline_style_tag, $inline_style);
 
77
  update_option($login_tag, $login);
78
  update_option($admin_tag, $admin);
79
  update_option($vertical_tag, $vertical);
@@ -149,6 +153,8 @@ Please support if you like this plugin:
149
  <small><?php _e('Page IDs, separated by commas.', 'shailan-dropdown-menu'); ?></small></p>
150
 
151
  <p>
 
 
152
  <input type="checkbox" class="checkbox" id="<?php echo $login_tag; ?>" name="<?php echo $login_tag; ?>"<?php checked( $login ); ?> />
153
  <label for="<?php echo $login_tag; ?>"><?php _e( 'Add login/logout', 'shailan-dropdown-menu' ); ?></label><br />
154
  <input type="checkbox" class="checkbox" id="<?php echo $admin_tag; ?>" name="<?php echo $admin_tag; ?>"<?php checked( $admin ); ?> />
@@ -185,6 +191,7 @@ Please support if you like this plugin:
185
  $type = $instance['type'];
186
  $exclude = $instance['exclude'];
187
  $inline_style = $instance['style'];
 
188
  $login = (bool) $instance['login'];
189
  $admin = (bool) $instance['admin'];
190
  $vertical = (bool) $instance['vertical'];
@@ -219,8 +226,14 @@ Please support if you like this plugin:
219
  <table cellpadding="0" cellspacing="0">
220
  <tr><td>
221
  <ul class="dropdown <?php echo $orientation; ?>">
 
 
 
 
 
 
222
  <?php if($type == 'Pages'){ ?>
223
- <li class="<?php if ( is_front_page() && !is_paged() ): ?>current_page_item<?php else: ?>page_item<?php endif; ?> blogtab"><a href="<?php echo get_option('home'); ?>/"><span><?php _e('Home', 'shailan-dropdown-menu'); ?></span></a></li>
224
  <?php
225
  $page_walker = new shailan_PageWalker();
226
  wp_list_pages(array(
@@ -230,7 +243,9 @@ Please support if you like this plugin:
230
  'title_li'=>'',
231
  'exclude'=>$exclude
232
  )); ?>
 
233
  <?php } else { ?>
 
234
  <?php
235
  $cat_walker = new shailan_CategoryWalker();
236
  wp_list_categories(array(
@@ -240,8 +255,11 @@ Please support if you like this plugin:
240
  'title_li'=>'',
241
  'exclude'=>$exclude
242
  )); ?>
 
243
  <?php } ?>
 
244
  <?php if($admin){ wp_register('<li class="admintab">','</li>'); } if($login){ ?><li class="page_item"><?php wp_loginout(); ?><?php } ?>
 
245
  </ul></td>
246
  </tr></table>
247
  </div>
@@ -261,6 +279,7 @@ Please support if you like this plugin:
261
  $type = $instance['type'];
262
  $exclude = $instance['exclude'];
263
  $inline_style = $instance['style'];
 
264
  $login = (bool) $instance['login'];
265
  $admin = (bool) $instance['admin'];
266
  $vertical = (bool) $instance['vertical'];
@@ -275,6 +294,8 @@ Please support if you like this plugin:
275
  <small>Page IDs, separated by commas.</small></p>
276
 
277
  <p>
 
 
278
  <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('login'); ?>" name="<?php echo $this->get_field_name('login'); ?>"<?php checked( $login ); ?> />
279
  <label for="<?php echo $this->get_field_id('login'); ?>"><?php _e( 'Add login/logout' , 'shailan-dropdown-menu' ); ?></label><br />
280
  <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('admin'); ?>" name="<?php echo $this->get_field_name('admin'); ?>"<?php checked( $admin ); ?> />
3
  Plugin Name: Shailan Dropdown Menu Widget
4
  Plugin URI: http://shailan.com/wordpress/plugins/dropdown-menu
5
  Description: A multi widget to generate drop-down menus from your pages and categories. This widget is best used in <a href="http://shailan.com">Shailan.com</a> themes. You can find more widgets, plugins and themes at <a href="http://shailan.com">shailan.com</a>.
6
+ Version: 1.2.7
7
  Author: Matt Say
8
  Author URI: http://shailan.com
9
  Text Domain: shailan-dropdown-menu
10
  */
11
 
12
+ define('SHAILAN_DM_VERSION','1.2.7');
13
  define('SHAILAN_DM_TITLE', 'Dropdown Menu');
14
  define('SHAILAN_DM_FOLDER', 'dropdown-menu-widget');
15
 
42
  $type_tag = 'shailan_dm_type';
43
  $exclude_tag = 'shailan_dm_exclude';
44
  $inline_style_tag = 'shailan_dm_style';
45
+ $home_tag = 'shailan_dm_home';
46
  $login_tag = 'shailan_dm_login';
47
  $admin_tag = 'shailan_dm_admin';
48
  $vertical_tag = 'shailan_dm_vertical';
54
  $type = get_option($type_tag);
55
  $exclude = get_option($exclude_tag);
56
  $inline_style = get_option($inline_style_tag);
57
+ $home = (bool) get_option($home_tag);
58
  $login = (bool) get_option($login_tag);
59
  $admin = (bool) get_option($admin_tag);
60
  $vertical = (bool) get_option($vertical_tag);
67
  $type = $_POST[$type_tag];
68
  $exclude = $_POST[$exclude_tag];
69
  $inline_style = $_POST[$inline_style_tag];
70
+ $home = (bool) $_POST[$home_tag];
71
  $login = (bool) $_POST[$login_tag];
72
  $admin = (bool) $_POST[$admin_tag];
73
  $vertical = (bool) $_POST[$vertical_tag];
77
  update_option($type_tag, $type);
78
  update_option($exclude_tag, $exclude);
79
  update_option($inline_style_tag, $inline_style);
80
+ update_option($home_tag, $home);
81
  update_option($login_tag, $login);
82
  update_option($admin_tag, $admin);
83
  update_option($vertical_tag, $vertical);
153
  <small><?php _e('Page IDs, separated by commas.', 'shailan-dropdown-menu'); ?></small></p>
154
 
155
  <p>
156
+ <input type="checkbox" class="checkbox" id="<?php echo $home_tag; ?>" name="<?php echo $home_tag; ?>"<?php checked( $home ); ?> />
157
+ <label for="<?php echo $home_tag; ?>"><?php _e( 'Add homepage link', 'shailan-dropdown-menu' ); ?></label><br />
158
  <input type="checkbox" class="checkbox" id="<?php echo $login_tag; ?>" name="<?php echo $login_tag; ?>"<?php checked( $login ); ?> />
159
  <label for="<?php echo $login_tag; ?>"><?php _e( 'Add login/logout', 'shailan-dropdown-menu' ); ?></label><br />
160
  <input type="checkbox" class="checkbox" id="<?php echo $admin_tag; ?>" name="<?php echo $admin_tag; ?>"<?php checked( $admin ); ?> />
191
  $type = $instance['type'];
192
  $exclude = $instance['exclude'];
193
  $inline_style = $instance['style'];
194
+ $home = (bool) $instance['home'];
195
  $login = (bool) $instance['login'];
196
  $admin = (bool) $instance['admin'];
197
  $vertical = (bool) $instance['vertical'];
226
  <table cellpadding="0" cellspacing="0">
227
  <tr><td>
228
  <ul class="dropdown <?php echo $orientation; ?>">
229
+
230
+ <?php if($home){ ?>
231
+ <li class="page_item cat-item blogtab <?php if ( is_front_page() && !is_paged() ){ ?>current_page_item current-cat<?php } ?>"><a href="<?php echo get_option('home'); ?>/"><span><?php _e('Home', 'shailan-dropdown-menu'); ?></span></a></li>
232
+ <?php } ?>
233
+
234
+
235
  <?php if($type == 'Pages'){ ?>
236
+
237
  <?php
238
  $page_walker = new shailan_PageWalker();
239
  wp_list_pages(array(
243
  'title_li'=>'',
244
  'exclude'=>$exclude
245
  )); ?>
246
+
247
  <?php } else { ?>
248
+
249
  <?php
250
  $cat_walker = new shailan_CategoryWalker();
251
  wp_list_categories(array(
255
  'title_li'=>'',
256
  'exclude'=>$exclude
257
  )); ?>
258
+
259
  <?php } ?>
260
+
261
  <?php if($admin){ wp_register('<li class="admintab">','</li>'); } if($login){ ?><li class="page_item"><?php wp_loginout(); ?><?php } ?>
262
+
263
  </ul></td>
264
  </tr></table>
265
  </div>
279
  $type = $instance['type'];
280
  $exclude = $instance['exclude'];
281
  $inline_style = $instance['style'];
282
+ $home = (bool) $instance['home'];
283
  $login = (bool) $instance['login'];
284
  $admin = (bool) $instance['admin'];
285
  $vertical = (bool) $instance['vertical'];
294
  <small>Page IDs, separated by commas.</small></p>
295
 
296
  <p>
297
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('home'); ?>" name="<?php echo $this->get_field_name('home'); ?>"<?php checked( $home ); ?> />
298
+ <label for="<?php echo $this->get_field_id('home'); ?>"><?php _e( 'Add homepage link' , 'shailan-dropdown-menu' ); ?></label><br />
299
  <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('login'); ?>" name="<?php echo $this->get_field_name('login'); ?>"<?php checked( $login ); ?> />
300
  <label for="<?php echo $this->get_field_id('login'); ?>"><?php _e( 'Add login/logout' , 'shailan-dropdown-menu' ); ?></label><br />
301
  <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('admin'); ?>" name="<?php echo $this->get_field_name('admin'); ?>"<?php checked( $admin ); ?> />