JQuery Accordion Menu Widget - Version 2.4

Version Description

  • Added: Ability to auto-expand menu based on the Wordpress current page/menu item classes
Download this release

Release Info

Developer remix4
Plugin Icon wp plugin JQuery Accordion Menu Widget
Version 2.4
Comparing to
See all releases

Code changes from version 2.3 to 2.4

dcwp_jquery_accordion.php CHANGED
@@ -5,7 +5,7 @@
5
Tags: jquery, dropdown, menu, vertical accordion, animated, css, navigation, accordion
6
Description: Creates a widget, which allows you to create vertical accordion menus from any Wordpress custom menu using jQuery. Features include - handles multiple levels, saved state using cookies and option of selecting "click" or "hover" events for triggering the menu.
7
Author: Lee Chestnutt
8
- Version: 2.3
9
Author URI: http://www.designchemical.com
10
*/
11
@@ -24,7 +24,7 @@ class dc_jqaccordion {
24
wp_enqueue_script( 'jquery' );
25
wp_enqueue_script( 'jqueryhoverintent', dc_jqaccordion::get_plugin_directory() . '/js/jquery.hoverIntent.minified.js', array('jquery') );
26
wp_enqueue_script( 'jquerycookie', dc_jqaccordion::get_plugin_directory() . '/js/jquery.cookie.js', array('jquery') );
27
- wp_enqueue_script( 'dcjqaccordion', dc_jqaccordion::get_plugin_directory() . '/js/jquery.dcjqaccordion.2.4.js', array('jquery') );
28
}
29
add_action( 'wp_footer', array('dc_jqaccordion', 'footer') );
30
5
Tags: jquery, dropdown, menu, vertical accordion, animated, css, navigation, accordion
6
Description: Creates a widget, which allows you to create vertical accordion menus from any Wordpress custom menu using jQuery. Features include - handles multiple levels, saved state using cookies and option of selecting "click" or "hover" events for triggering the menu.
7
Author: Lee Chestnutt
8
+ Version: 2.4
9
Author URI: http://www.designchemical.com
10
*/
11
24
wp_enqueue_script( 'jquery' );
25
wp_enqueue_script( 'jqueryhoverintent', dc_jqaccordion::get_plugin_directory() . '/js/jquery.hoverIntent.minified.js', array('jquery') );
26
wp_enqueue_script( 'jquerycookie', dc_jqaccordion::get_plugin_directory() . '/js/jquery.cookie.js', array('jquery') );
27
+ wp_enqueue_script( 'dcjqaccordion', dc_jqaccordion::get_plugin_directory() . '/js/jquery.dcjqaccordion.2.5.js', array('jquery') );
28
}
29
add_action( 'wp_footer', array('dc_jqaccordion', 'footer') );
30
dcwp_jquery_accordion_widget.php CHANGED
@@ -25,13 +25,12 @@ class dc_jqaccordion_widget extends WP_Widget {
25
26
$this->defaults = array(
27
'title' => '',
28
- 'classParent' => 'dcjq-parent',
29
- 'classActive' => 'active',
30
'event' => 'click',
31
'hoverDelay' => '300',
32
'menuClose' => 'on',
33
'autoClose' => 'on',
34
'saveState' => 'on',
35
'showCount' => 'off',
36
'speed' => 'slow',
37
'disableLink' => 'on',
@@ -81,10 +80,9 @@ class dc_jqaccordion_widget extends WP_Widget {
81
$instance['autoClose'] = $new_instance['autoClose'];
82
$instance['menuClose'] = $new_instance['menuClose'];
83
$instance['saveState'] = $new_instance['saveState'];
84
$instance['disableLink'] = $new_instance['disableLink'];
85
$instance['showCount'] = $new_instance['showCount'];
86
- $instance['classParent'] = strip_tags( stripslashes($new_instance['classParent']) );
87
- $instance['classActive'] = strip_tags( stripslashes($new_instance['classActive']) );
88
$instance['event'] = strip_tags( stripslashes($new_instance['event']) );
89
$instance['skin'] = $new_instance['skin'];
90
$instance['speed'] = $new_instance['speed'];
@@ -101,9 +99,8 @@ class dc_jqaccordion_widget extends WP_Widget {
101
if(! isset($instance['saveState']) ){ $instance['saveState'] = 'false'; }
102
if(! isset($instance['menuClose']) ){ $instance['menuClose'] = 'false'; }
103
if(! isset($instance['disableLink']) ){ $instance['disableLink'] = 'false'; }
104
if(! isset($instance['showCount']) ){ $instance['showCount'] = 'false'; }
105
- $classParent = isset( $instance['classParent'] ) ? $instance['classParent'] : '';
106
- $classActive = isset( $instance['classActive'] ) ? $instance['classActive'] : '';
107
$event = isset( $instance['event'] ) ? $instance['event'] : '';
108
$skin = isset( $instance['skin'] ) ? $instance['skin'] : '';
109
$speed = isset( $instance['speed'] ) ? $instance['speed'] : '';
@@ -149,6 +146,9 @@ class dc_jqaccordion_widget extends WP_Widget {
149
<input type="checkbox" value="true" class="checkbox" id="<?php echo $this->get_field_id('saveState'); ?>" name="<?php echo $this->get_field_name('saveState'); ?>"<?php checked( $saveState, 'true'); ?> />
150
<label for="<?php echo $this->get_field_id('saveState'); ?>"><?php _e( 'Save Menu State (uses cookies)' , 'dcjq-accordion' ); ?></label><br />
151
152
<input type="checkbox" value="true" class="checkbox" id="<?php echo $this->get_field_id('disableLink'); ?>" name="<?php echo $this->get_field_name('disableLink'); ?>"<?php checked( $disableLink, 'true' ); ?> />
153
<label for="<?php echo $this->get_field_id('disableLink'); ?>"><?php _e( 'Disable Parent Links' , 'dcjq-accordion' ); ?></label><br />
154
@@ -200,8 +200,6 @@ class dc_jqaccordion_widget extends WP_Widget {
200
closedir($dh);
201
echo "</select>"; ?> </label><br />
202
</p>
203
- <input type="hidden" id="<?php echo $this->get_field_id('classParent'); ?>" name="<?php echo $this->get_field_name('classParent'); ?>" value="dcjq-parent" />
204
- <input type="hidden" id="<?php echo $this->get_field_id('classActive'); ?>" name="<?php echo $this->get_field_name('classActive'); ?>" value="active" />
205
<div class="widget-control-actions alignright">
206
<p><small><a href="http://www.designchemical.com/blog/index.php/wordpress-plugins/wordpress-plugin-jquery-vertical-accordion-menu-widget/"><?php esc_attr_e('Visit plugin site', 'dcjq-accordion'); ?></a></small></p>
207
</div>
@@ -223,7 +221,7 @@ class dc_jqaccordion_widget extends WP_Widget {
223
$skin = $wpdcjqaccordion['skin'];
224
$skin = htmlspecialchars(ucfirst(preg_replace('/\..*#x2F;', '', $skin)));
225
if('no-theme'!=$skin){
226
- echo "\n\t<link rel=\"stylesheet\" href=\"".dc_jqaccordion::get_plugin_directory()."/skin.php?widget_id=".$key."&skin=".strtolower($skin)."\" type=\"text/css\" media=\"screen\" />";
227
}
228
}
229
}
@@ -255,6 +253,9 @@ class dc_jqaccordion_widget extends WP_Widget {
255
$menuClose = $wpdcjqaccordion['menuClose'];
256
if($menuClose == ''){$menuClose = 'false';};
257
258
$showCount = $wpdcjqaccordion['showCount'];
259
if($showCount == ''){$showCount = 'false';};
260
@@ -265,13 +266,13 @@ class dc_jqaccordion_widget extends WP_Widget {
265
<script type="text/javascript">
266
jQuery(document).ready(function($) {
267
jQuery('#<?php echo $widget_id.'-item'; ?> .menu').dcAccordion({
268
- classParent: '<?php echo $wpdcjqaccordion['classParent']; ?>',
269
- classActive: '<?php echo $wpdcjqaccordion['classActive']; ?>',
270
eventType: '<?php echo $wpdcjqaccordion['event']; ?>',
271
hoverDelay: <?php echo $hoverDelay; ?>,
272
menuClose: <?php echo $menuClose; ?>,
273
autoClose: <?php echo $autoClose; ?>,
274
saveState: <?php echo $saveState; ?>,
275
showCount: <?php echo $showCount; ?>,
276
disableLink: <?php echo $disableLink; ?>,
277
cookie: '<?php echo $widget_id; ?>',
25
26
$this->defaults = array(
27
'title' => '',
28
'event' => 'click',
29
'hoverDelay' => '300',
30
'menuClose' => 'on',
31
'autoClose' => 'on',
32
'saveState' => 'on',
33
+ 'autoExpand' => 'off',
34
'showCount' => 'off',
35
'speed' => 'slow',
36
'disableLink' => 'on',
80
$instance['autoClose'] = $new_instance['autoClose'];
81
$instance['menuClose'] = $new_instance['menuClose'];
82
$instance['saveState'] = $new_instance['saveState'];
83
+ $instance['autoExpand'] = $new_instance['autoExpand'];
84
$instance['disableLink'] = $new_instance['disableLink'];
85
$instance['showCount'] = $new_instance['showCount'];
86
$instance['event'] = strip_tags( stripslashes($new_instance['event']) );
87
$instance['skin'] = $new_instance['skin'];
88
$instance['speed'] = $new_instance['speed'];
99
if(! isset($instance['saveState']) ){ $instance['saveState'] = 'false'; }
100
if(! isset($instance['menuClose']) ){ $instance['menuClose'] = 'false'; }
101
if(! isset($instance['disableLink']) ){ $instance['disableLink'] = 'false'; }
102
+ if(! isset($instance['autoExpand']) ){ $instance['autoExpand'] = 'false'; }
103
if(! isset($instance['showCount']) ){ $instance['showCount'] = 'false'; }
104
$event = isset( $instance['event'] ) ? $instance['event'] : '';
105
$skin = isset( $instance['skin'] ) ? $instance['skin'] : '';
106
$speed = isset( $instance['speed'] ) ? $instance['speed'] : '';
146
<input type="checkbox" value="true" class="checkbox" id="<?php echo $this->get_field_id('saveState'); ?>" name="<?php echo $this->get_field_name('saveState'); ?>"<?php checked( $saveState, 'true'); ?> />
147
<label for="<?php echo $this->get_field_id('saveState'); ?>"><?php _e( 'Save Menu State (uses cookies)' , 'dcjq-accordion' ); ?></label><br />
148
149
+ <input type="checkbox" value="true" class="checkbox" id="<?php echo $this->get_field_id('autoExpand'); ?>" name="<?php echo $this->get_field_name('autoExpand'); ?>"<?php checked( $autoExpand, 'true' ); ?> />
150
+ <label for="<?php echo $this->get_field_id('autoExpand'); ?>"><?php _e( 'Auto Expand Based on Current Page/Item' , 'dcjq-accordion' ); ?></label><br />
151
+
152
<input type="checkbox" value="true" class="checkbox" id="<?php echo $this->get_field_id('disableLink'); ?>" name="<?php echo $this->get_field_name('disableLink'); ?>"<?php checked( $disableLink, 'true' ); ?> />
153
<label for="<?php echo $this->get_field_id('disableLink'); ?>"><?php _e( 'Disable Parent Links' , 'dcjq-accordion' ); ?></label><br />
154
200
closedir($dh);
201
echo "</select>"; ?> </label><br />
202
</p>
203
<div class="widget-control-actions alignright">
204
<p><small><a href="http://www.designchemical.com/blog/index.php/wordpress-plugins/wordpress-plugin-jquery-vertical-accordion-menu-widget/"><?php esc_attr_e('Visit plugin site', 'dcjq-accordion'); ?></a></small></p>
205
</div>
221
$skin = $wpdcjqaccordion['skin'];
222
$skin = htmlspecialchars(ucfirst(preg_replace('/\..*#x2F;', '', $skin)));
223
if('no-theme'!=$skin){
224
+ echo "\n\t<link rel=\"stylesheet\" href=\"".dc_jqaccordion::get_plugin_directory()."/skin.php?widget_id=".$key."&amp;skin=".strtolower($skin)."\" type=\"text/css\" media=\"screen\" />";
225
}
226
}
227
}
253
$menuClose = $wpdcjqaccordion['menuClose'];
254
if($menuClose == ''){$menuClose = 'false';};
255
256
+ $autoExpand = $wpdcjqaccordion['autoExpand'];
257
+ if($autoExpand == ''){$autoExpand = 'false';}
258
+
259
$showCount = $wpdcjqaccordion['showCount'];
260
if($showCount == ''){$showCount = 'false';};
261
266
<script type="text/javascript">
267
jQuery(document).ready(function($) {
268
jQuery('#<?php echo $widget_id.'-item'; ?> .menu').dcAccordion({
269
eventType: '<?php echo $wpdcjqaccordion['event']; ?>',
270
hoverDelay: <?php echo $hoverDelay; ?>,
271
menuClose: <?php echo $menuClose; ?>,
272
autoClose: <?php echo $autoClose; ?>,
273
saveState: <?php echo $saveState; ?>,
274
+ autoExpand: <?php echo $autoExpand; ?>,
275
+ classExpand: 'current-menu-ancestor',
276
showCount: <?php echo $showCount; ?>,
277
disableLink: <?php echo $disableLink; ?>,
278
cookie: '<?php echo $widget_id; ?>',
js/{jquery.dcjqaccordion.2.4.js → jquery.dcjqaccordion.2.5.js} RENAMED
@@ -13,10 +13,12 @@
13
var defaults = {
14
classParent : 'dcjq-parent',
15
classActive : 'active',
16
eventType : 'click',
17
hoverDelay : 300,
18
menuClose : true,
19
autoClose : true,
20
speed : 'slow',
21
saveState : true,
22
disableLink : true,
@@ -149,6 +151,9 @@
149
$('> a',$parentsLi).addClass(defaults.classActive);
150
});
151
}
152
}
153
// Reset accordion using active links
154
function resetAccordion(){
13
var defaults = {
14
classParent : 'dcjq-parent',
15
classActive : 'active',
16
+ classExpand : 'dcjq-current-parent',
17
eventType : 'click',
18
hoverDelay : 300,
19
menuClose : true,
20
autoClose : true,
21
+ autoExpand : false,
22
speed : 'slow',
23
saveState : true,
24
disableLink : true,
151
$('> a',$parentsLi).addClass(defaults.classActive);
152
});
153
}
154
+ if(defaults.autoExpand == true){
155
+ $('li.'+defaults.classExpand+' > a').addClass(defaults.classActive);
156
+ }
157
}
158
// Reset accordion using active links
159
function resetAccordion(){
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.designchemical.com
4
Tags: jquery, dropdown, menu, vertical accordion, animated, css, navigation, widget
5
Requires at least: 3.0
6
Tested up to: 3.1
7
- Stable tag: 2.3
8
9
Creates a widget, which allows you to create vertical accordion menus from any Wordpress custom menu using jQuery.
10
@@ -19,6 +19,7 @@ The widget has several parameters that can be configured to help cutomise the ve
19
* Click/Hover - Selects the event type that will trigger the menu to open/close
20
* Auto-close open menus - If checked this will allow only one menu item to be expanded at any time. Clicking on a new menu item will automatically close the previous one.
21
* Save menu state (uses cookies) - Selecting this will allow the menu to remember its open/close state when browsing to a new page.
22
* Disable parent links - If selected, any menu items that have child elements will have their links disabled and will only open/close their relevant sub-menus. Do not select this if you want the user to still be able to browse to that item's page.
23
* Close menu (hover only) - If checked the menu will automatically fully close after 1 second when the mouse moves off the menu - only available if event type is "hover"
24
* Show Count - If checked the menu will automatically add a count showing the number of links under each parent menu item
@@ -54,6 +55,9 @@ Another likely cause is due to other non-functioning plugins, which may have err
54
55
== Changelog ==
56
57
= 2.3 =
58
* Edit: Plugin now works with Cufon text
59
4
Tags: jquery, dropdown, menu, vertical accordion, animated, css, navigation, widget
5
Requires at least: 3.0
6
Tested up to: 3.1
7
+ Stable tag: 2.4
8
9
Creates a widget, which allows you to create vertical accordion menus from any Wordpress custom menu using jQuery.
10
19
* Click/Hover - Selects the event type that will trigger the menu to open/close
20
* Auto-close open menus - If checked this will allow only one menu item to be expanded at any time. Clicking on a new menu item will automatically close the previous one.
21
* Save menu state (uses cookies) - Selecting this will allow the menu to remember its open/close state when browsing to a new page.
22
+ * Auto Expand Based on Current Page/Item (requires "Save State On") - If checked, this option will automatically expand sub-menus based on the current page/post based on the inherent Wordpress custom menu css classes - e.g. select this option if you would like the menu to automatically expand when the user clicks a link other than the accordion menu.
23
* Disable parent links - If selected, any menu items that have child elements will have their links disabled and will only open/close their relevant sub-menus. Do not select this if you want the user to still be able to browse to that item's page.
24
* Close menu (hover only) - If checked the menu will automatically fully close after 1 second when the mouse moves off the menu - only available if event type is "hover"
25
* Show Count - If checked the menu will automatically add a count showing the number of links under each parent menu item
55
56
== Changelog ==
57
58
+ = 2.4 =
59
+ * Added: Ability to auto-expand menu based on the Wordpress current page/menu item classes
60
+
61
= 2.3 =
62
* Edit: Plugin now works with Cufon text
63
screenshot-1.png CHANGED
Binary file