Dropdown Menu Widget - Version 1.1.0

Version Description

  • Added custom walker class to disable title attributes on menu items.
  • Renamed class and style files.
  • Fixed default theme.
Download this release

Release Info

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

Code changes from version 1.0.0 to 1.1.0

Thumbs.db DELETED
Binary file
images/Thumbs.db DELETED
Binary file
readme.txt CHANGED
@@ -4,19 +4,20 @@ 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.8.6
7
- Stable tag: 1.0.0
8
 
9
- This widget adds a beatiful, CSS only dropdown menu of pages OR categories of your blog.
10
 
11
  == Description ==
12
 
13
- Dropdown Menu widget adds a beautiful, CSS only dropdown menu, listing pages OR categories of your blog. It supports multiple instances. You can select a theme for your widget from the Dropdown Menu Settings page. If you don't like ready-made templates you can create your own theme for the menus using CSS. Hope you like it.
14
 
15
  == Installation ==
16
 
17
- 1. Upload `shailan.DropdownMenu` folder to your `/wp-content/plugins/` directory
18
  1. Activate the plugin through the 'Plugins' menu in WordPress
19
  1. Go to Appearance -> Widgets to add this widget to one of your sidebars
 
20
 
21
  == Frequently Asked Questions ==
22
 
@@ -30,7 +31,12 @@ This widget is intented for *wide header widget areas*, not regular sidebars. Yo
30
 
31
  == Changelog ==
32
 
33
- = 1.0 =
 
 
 
 
 
34
  * Added vertical dropdown menu functionality.
35
  * Fixed widget code.
36
  * Changed dropdown widget classname to : shailan-dropdown-menu
4
  Tags: css, dropdown, menu, widget, pages, categories
5
  Requires at least: 2.5
6
  Tested up to: 2.8.6
7
+ Stable tag: 1.1.0
8
 
9
+ This widget adds a beatiful vertical/horizontal CSS only dropdown menu of pages OR categories of your blog.
10
 
11
  == Description ==
12
 
13
+ Dropdown Menu widget adds a beautiful, CSS only dropdown menu, listing pages OR categories of your blog. It allows you to chose vertical or horizontal. It supports multiple instances. You can select a theme for your widget from the Dropdown Menu Settings page. If you don't like ready-made templates you can create your own theme for the menus using CSS. Hope you like it.
14
 
15
  == Installation ==
16
 
17
+ 1. Upload the plugin to your `/wp-content/plugins/` directory
18
  1. Activate the plugin through the 'Plugins' menu in WordPress
19
  1. Go to Appearance -> Widgets to add this widget to one of your sidebars
20
+ 1. You can also use `<?php shailan_dropdown_menu(); ?>` in your template to display the menu.
21
 
22
  == Frequently Asked Questions ==
23
 
31
 
32
  == Changelog ==
33
 
34
+ = 1.1.0 =
35
+ * Added custom walker class to disable title attributes on menu items.
36
+ * Renamed class and style files.
37
+ * Fixed default theme.
38
+
39
+ = 1.0.0 =
40
  * Added vertical dropdown menu functionality.
41
  * Fixed widget code.
42
  * Changed dropdown widget classname to : shailan-dropdown-menu
shailan.DropdownStyles.css → shailan-dropdown.css RENAMED
File without changes
shailan-page-walker.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php // is the love
2
+
3
+ /**
4
+ * Create HTML dropdown list of pages WITHOUT A TITLE ATTRIBUTE.
5
+ *
6
+ * @package Shailan Dropdown Menu Widget
7
+ * @since 2.1.0
8
+ * @uses Walker
9
+ */
10
+ class shailan_PageWalker extends Walker {
11
+ /**
12
+ * @see Walker::$tree_type
13
+ * @since 2.1.0
14
+ * @var string
15
+ */
16
+ var $tree_type = 'page';
17
+
18
+ /**
19
+ * @see Walker::$db_fields
20
+ * @since 2.1.0
21
+ * @todo Decouple this
22
+ * @var array
23
+ */
24
+ var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
25
+
26
+ /**
27
+ * @see Walker::start_lvl()
28
+ * @since 2.1.0
29
+ *
30
+ * @param string $output Passed by reference. Used to append additional content.
31
+ * @param int $depth Depth of page. Used for padding.
32
+ */
33
+ function start_lvl(&$output, $depth) {
34
+ $indent = str_repeat("\t", $depth);
35
+ $output .= "\n$indent<ul>\n";
36
+ }
37
+
38
+ /**
39
+ * @see Walker::end_lvl()
40
+ * @since 2.1.0
41
+ *
42
+ * @param string $output Passed by reference. Used to append additional content.
43
+ * @param int $depth Depth of page. Used for padding.
44
+ */
45
+ function end_lvl(&$output, $depth) {
46
+ $indent = str_repeat("\t", $depth);
47
+ $output .= "$indent</ul>\n";
48
+ }
49
+
50
+ /**
51
+ * @see Walker::start_el()
52
+ * @since 2.1.0
53
+ *
54
+ * @param string $output Passed by reference. Used to append additional content.
55
+ * @param object $page Page data object.
56
+ * @param int $depth Depth of page in reference to parent pages. Used for padding.
57
+ * @param array $args Uses 'selected' argument for selected page to set selected HTML attribute for option element.
58
+ */
59
+ function start_el(&$output, $page, $depth, $args, $current_page) {
60
+ if ( $depth )
61
+ $indent = str_repeat("\t", $depth);
62
+ else
63
+ $indent = '';
64
+
65
+ extract($args, EXTR_SKIP);
66
+ $css_class = array('page_item', 'page-item-'.$page->ID);
67
+ if ( !empty($current_page) ) {
68
+ $_current_page = get_page( $current_page );
69
+ if ( isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors) )
70
+ $css_class[] = 'current_page_ancestor';
71
+ if ( $page->ID == $current_page )
72
+ $css_class[] = 'current_page_item';
73
+ elseif ( $_current_page && $page->ID == $_current_page->post_parent )
74
+ $css_class[] = 'current_page_parent';
75
+ } elseif ( $page->ID == get_option('page_for_posts') ) {
76
+ $css_class[] = 'current_page_parent';
77
+ }
78
+
79
+ $css_class = implode(' ', apply_filters('page_css_class', $css_class, $page));
80
+
81
+ $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" >' . $link_before . apply_filters('the_title', $page->post_title) . $link_after . '</a>';
82
+
83
+ if ( !empty($show_date) ) {
84
+ if ( 'modified' == $show_date )
85
+ $time = $page->post_modified;
86
+ else
87
+ $time = $page->post_date;
88
+
89
+ $output .= " " . mysql2date($date_format, $time);
90
+ }
91
+ }
92
+
93
+ /**
94
+ * @see Walker::end_el()
95
+ * @since 2.1.0
96
+ *
97
+ * @param string $output Passed by reference. Used to append additional content.
98
+ * @param object $page Page data object. Not used.
99
+ * @param int $depth Depth of page. Not Used.
100
+ */
101
+ function end_el(&$output, $page, $depth) {
102
+ $output .= "</li>\n";
103
+ }
104
+ }
shailan-theme-selector.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ function selectTheme(theme){
3
+ alert(theme);
4
+ }
5
+ </script>
6
+ <?php foreach($themes as $name=>$path){
7
+ $selected = ($theme == $path ? 'selected' : '');
8
+ echo '<div style="display:inline; float:left;text-align:center;font-size:0.8em; border:1px solid #ddd; margin:2px; padding:3px;"><a href="#" onclick="selectTheme(\''.$path.'\');return false;"><img src="'.WP_PLUGIN_URL.'/'.SHAILAN_DM_FOLDER.'/themes/'.$path.'.jpg" class="'.$selected.'" style="width:100px; border:1px solid #999;" title="'.$name.'" alt="'.$name.'"/></a><br />'.$name.'</div>';
9
+ } ?>
shailan.DropDownMenu.php CHANGED
@@ -3,12 +3,12 @@
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.0.0
7
  Author: Matt Say
8
  Author URI: http://shailan.com
9
  */
10
 
11
- define('SHAILAN_DM_VERSION','1.0.0');
12
  define('SHAILAN_DM_TITLE', 'Dropdown Menu');
13
  define('SHAILAN_DM_FOLDER', 'dropdown-menu-widget');
14
 
@@ -111,7 +111,7 @@ Please support if you like this plugin:
111
 
112
  <p>Dropdown menu creates a beautiful CSS only dropdown menu from your wordpress pages or categories. You can customize dropdown menu theme and settings here: </p>
113
 
114
- <form method="post" action="">
115
 
116
  <?php wp_nonce_field(); ?>
117
 
@@ -199,7 +199,15 @@ Here you can set template tag options:
199
  <ul class="dropdown <?php echo $orientation; ?>">
200
  <?php if($type == 'Pages'){ ?>
201
  <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'); ?>/"><?php _e('Home'); ?></a></li>
202
- <?php wp_list_pages('sort_column=menu_order&depth=4&title_li=&exclude='.$exclude); ?>
 
 
 
 
 
 
 
 
203
  <?php } else { ?>
204
  <?php wp_list_categories('order_by=name&depth=4&title_li=&exclude='.$exclude); ?>
205
  <?php } ?>
@@ -257,7 +265,7 @@ Here you can set template tag options:
257
  function styles($instance){
258
  $theme = get_option('theme');
259
 
260
- echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/'.SHAILAN_DM_FOLDER.'/shailan.DropdownStyles.css" type="text/css" />';
261
 
262
  if($theme!='NONE'){
263
  echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/'.SHAILAN_DM_FOLDER.'/themes/'.$theme.'.css" type="text/css" />';
@@ -278,6 +286,8 @@ Here you can set template tag options:
278
  add_action('widgets_init', create_function('', 'return register_widget("shailan_DropdownWidget");'));
279
  add_action('admin_menu', array('shailan_DropdownWidget', 'adminMenu'));
280
 
 
 
281
  function shailan_dropdown_menu(){
282
  $type = get_option('shailan_dm_type');
283
  $exclude = get_option('shailan_dm_exclude');
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.1.0
7
  Author: Matt Say
8
  Author URI: http://shailan.com
9
  */
10
 
11
+ define('SHAILAN_DM_VERSION','1.1.0');
12
  define('SHAILAN_DM_TITLE', 'Dropdown Menu');
13
  define('SHAILAN_DM_FOLDER', 'dropdown-menu-widget');
14
 
111
 
112
  <p>Dropdown menu creates a beautiful CSS only dropdown menu from your wordpress pages or categories. You can customize dropdown menu theme and settings here: </p>
113
 
114
+ <form id="frmShailanDm" name="frmShailanDm" method="post" action="">
115
 
116
  <?php wp_nonce_field(); ?>
117
 
199
  <ul class="dropdown <?php echo $orientation; ?>">
200
  <?php if($type == 'Pages'){ ?>
201
  <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'); ?>/"><?php _e('Home'); ?></a></li>
202
+ <?php
203
+ $page_walker = new shailan_PageWalker();
204
+ wp_list_pages(array(
205
+ 'walker'=>$page_walker,
206
+ 'sort_column'=>'menu_order',
207
+ 'depth'=>'4',
208
+ 'title_li'=>'',
209
+ 'exclude'=>$exclude
210
+ )); ?>
211
  <?php } else { ?>
212
  <?php wp_list_categories('order_by=name&depth=4&title_li=&exclude='.$exclude); ?>
213
  <?php } ?>
265
  function styles($instance){
266
  $theme = get_option('theme');
267
 
268
+ echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/'.SHAILAN_DM_FOLDER.'/shailan-dropdown.css" type="text/css" />';
269
 
270
  if($theme!='NONE'){
271
  echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/'.SHAILAN_DM_FOLDER.'/themes/'.$theme.'.css" type="text/css" />';
286
  add_action('widgets_init', create_function('', 'return register_widget("shailan_DropdownWidget");'));
287
  add_action('admin_menu', array('shailan_DropdownWidget', 'adminMenu'));
288
 
289
+ include('shailan-page-walker.php'); // Load custom page walker
290
+
291
  function shailan_dropdown_menu(){
292
  $type = get_option('shailan_dm_type');
293
  $exclude = get_option('shailan_dm_exclude');