Version Description
- New: Add Mobile Sub Menu Default State option to menu location settings
- New: Add support for 'expand-on-mobile' custom class to expand sub menu by default on mobile
- Fix: Theme export always exported the 'Default' theme
- Fix: Check depth property exists for compatibility with plugins that dynamically add items to the menu
- Improvement: Localise widget title string
Download this release
Release Info
Developer | megamenu |
Plugin | Max Mega Menu |
Version | 2.9.2 |
Comparing to | |
See all releases |
Code changes from version 2.9.1 to 2.9.2
- classes/pages/locations.php +39 -1
- classes/pages/themes.php +3 -3
- classes/widgets/widget.class.php +1 -1
- css/admin/admin.css +2 -1
- css/admin/admin.scss +2 -2
- js/maxmegamenu.js +24 -0
- megamenu.php +13 -6
- readme.txt +11 -3
classes/pages/locations.php
CHANGED
@@ -724,7 +724,7 @@ if ( ! class_exists( 'Mega_Menu_Locations' ) ) :
|
|
724 |
),
|
725 |
'mobile_behaviour' => array(
|
726 |
'priority' => 20,
|
727 |
-
'title' => __( 'Mobile Menu Behaviour', 'megamenu' ),
|
728 |
'description' => __( 'Define the sub menu toggle behaviour for the mobile menu.', 'megamenu' ),
|
729 |
'settings' => array(
|
730 |
array(
|
@@ -734,6 +734,18 @@ if ( ! class_exists( 'Mega_Menu_Locations' ) ) :
|
|
734 |
),
|
735 |
),
|
736 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
737 |
'descriptions' => array(
|
738 |
'priority' => 20,
|
739 |
'title' => __( 'Menu Item Descriptions', 'megamenu' ),
|
@@ -986,6 +998,9 @@ if ( ! class_exists( 'Mega_Menu_Locations' ) ) :
|
|
986 |
case 'mobile_behaviour':
|
987 |
$this->print_mobile_behaviour_option( $location, $setting['value'] );
|
988 |
break;
|
|
|
|
|
|
|
989 |
case 'container':
|
990 |
$this->print_container_option( $location, $setting['value'] );
|
991 |
break;
|
@@ -1257,6 +1272,29 @@ if ( ! class_exists( 'Mega_Menu_Locations' ) ) :
|
|
1257 |
<?php
|
1258 |
}
|
1259 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1260 |
|
1261 |
/**
|
1262 |
* Print the container option select box
|
724 |
),
|
725 |
'mobile_behaviour' => array(
|
726 |
'priority' => 20,
|
727 |
+
'title' => __( 'Mobile Sub Menu Behaviour', 'megamenu' ),
|
728 |
'description' => __( 'Define the sub menu toggle behaviour for the mobile menu.', 'megamenu' ),
|
729 |
'settings' => array(
|
730 |
array(
|
734 |
),
|
735 |
),
|
736 |
),
|
737 |
+
'mobile_state' => array(
|
738 |
+
'priority' => 20,
|
739 |
+
'title' => __( 'Mobile Sub Menu Default State', 'megamenu' ),
|
740 |
+
'description' => __( 'Define the default state of the sub menus when the mobile menu is visible.', 'megamenu' ),
|
741 |
+
'settings' => array(
|
742 |
+
array(
|
743 |
+
'type' => 'mobile_state',
|
744 |
+
'key' => 'mobile_state',
|
745 |
+
'value' => $plugin_settings,
|
746 |
+
),
|
747 |
+
),
|
748 |
+
),
|
749 |
'descriptions' => array(
|
750 |
'priority' => 20,
|
751 |
'title' => __( 'Menu Item Descriptions', 'megamenu' ),
|
998 |
case 'mobile_behaviour':
|
999 |
$this->print_mobile_behaviour_option( $location, $setting['value'] );
|
1000 |
break;
|
1001 |
+
case 'mobile_state':
|
1002 |
+
$this->print_mobile_state_option( $location, $setting['value'] );
|
1003 |
+
break;
|
1004 |
case 'container':
|
1005 |
$this->print_container_option( $location, $setting['value'] );
|
1006 |
break;
|
1272 |
<?php
|
1273 |
}
|
1274 |
|
1275 |
+
/**
|
1276 |
+
* Print the mobile menu behaviour option
|
1277 |
+
*
|
1278 |
+
* @since 2.8
|
1279 |
+
* @param string $key
|
1280 |
+
* @param string $value
|
1281 |
+
*/
|
1282 |
+
public function print_mobile_state_option( $location, $plugin_settings ) {
|
1283 |
+
$mobile_state = 'collapse_all';
|
1284 |
+
|
1285 |
+
if ( isset( $plugin_settings[ $location ]['mobile_state'] ) ) {
|
1286 |
+
$mobile_state = $plugin_settings[ $location ]['mobile_state'];
|
1287 |
+
}
|
1288 |
+
|
1289 |
+
?>
|
1290 |
+
<select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][mobile_state]'>
|
1291 |
+
<option value='collapse_all' <?php echo selected( $mobile_state == 'collapse_all' ); ?>><?php _e( 'Collapse all', 'megamenu' ); ?></option>
|
1292 |
+
<option value='expand_all' <?php echo selected( $mobile_state == 'expand_all' ); ?>><?php _e( 'Expand all', 'megamenu' ); ?></option>
|
1293 |
+
<option value='expand_active' <?php echo selected( $mobile_state == 'expand_active' ); ?>><?php _e( 'Expand active parents', 'megamenu' ); ?></option>
|
1294 |
+
<select>
|
1295 |
+
<?php
|
1296 |
+
}
|
1297 |
+
|
1298 |
|
1299 |
/**
|
1300 |
* Print the container option select box
|
classes/pages/themes.php
CHANGED
@@ -726,9 +726,9 @@ if ( ! class_exists( 'Mega_Menu_Themes' ) ) :
|
|
726 |
$export_url = esc_url(
|
727 |
add_query_arg(
|
728 |
array(
|
729 |
-
'page'
|
730 |
-
'
|
731 |
-
'export'
|
732 |
),
|
733 |
admin_url( 'admin.php' )
|
734 |
)
|
726 |
$export_url = esc_url(
|
727 |
add_query_arg(
|
728 |
array(
|
729 |
+
'page' => 'maxmegamenu_theme_editor',
|
730 |
+
'theme' => $this->id,
|
731 |
+
'export' => 'true',
|
732 |
),
|
733 |
admin_url( 'admin.php' )
|
734 |
)
|
classes/widgets/widget.class.php
CHANGED
@@ -17,7 +17,7 @@ if ( ! class_exists( 'Mega_Menu_Widget' ) ) :
|
|
17 |
public function __construct() {
|
18 |
parent::__construct(
|
19 |
'maxmegamenu', // Base ID
|
20 |
-
'Max Mega Menu', // Name
|
21 |
array( 'description' => __( 'Outputs a menu for a selected theme location.', 'megamenu' ) ) // Args
|
22 |
);
|
23 |
}
|
17 |
public function __construct() {
|
18 |
parent::__construct(
|
19 |
'maxmegamenu', // Base ID
|
20 |
+
__( 'Max Mega Menu', 'megamenu' ), // Name
|
21 |
array( 'description' => __( 'Outputs a menu for a selected theme location.', 'megamenu' ) ) // Args
|
22 |
);
|
23 |
}
|
css/admin/admin.css
CHANGED
@@ -700,7 +700,8 @@ body.toplevel_page_maxmegamenu .mega-tooltip[data-tooltip-disabled],
|
|
700 |
font-size: 11px; }
|
701 |
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid .mega-row-settings button {
|
702 |
display: block; }
|
703 |
-
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid .dashicons
|
|
|
704 |
font-size: 13px;
|
705 |
width: 15px;
|
706 |
cursor: pointer; }
|
700 |
font-size: 11px; }
|
701 |
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid .mega-row-settings button {
|
702 |
display: block; }
|
703 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid .mega-row-header .dashicons,
|
704 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid .mega-col-header .dashicons {
|
705 |
font-size: 13px;
|
706 |
width: 15px;
|
707 |
cursor: pointer; }
|
css/admin/admin.scss
CHANGED
@@ -718,8 +718,8 @@ body.toplevel_page_maxmegamenu,
|
|
718 |
display: block;
|
719 |
}
|
720 |
}
|
721 |
-
|
722 |
-
.dashicons {
|
723 |
font-size: 13px;
|
724 |
width: 15px;
|
725 |
cursor: pointer;
|
718 |
display: block;
|
719 |
}
|
720 |
}
|
721 |
+
.mega-row-header .dashicons,
|
722 |
+
.mega-col-header .dashicons {
|
723 |
font-size: 13px;
|
724 |
width: 15px;
|
725 |
cursor: pointer;
|
js/maxmegamenu.js
CHANGED
@@ -21,6 +21,7 @@
|
|
21 |
panel_inner_width: $menu.attr("data-panel-inner-width"),
|
22 |
mobile_force_width: $menu.attr("data-mobile-force-width"),
|
23 |
mobile_overlay: $menu.attr("data-mobile-overlay"),
|
|
|
24 |
second_click: $menu.attr("data-second-click"),
|
25 |
vertical_behaviour: $menu.attr("data-vertical-behaviour"),
|
26 |
document_click: $menu.attr("data-document-click"),
|
@@ -61,6 +62,28 @@
|
|
61 |
});
|
62 |
};
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
plugin.hideSiblingPanels = function(anchor, immediate) {
|
65 |
anchor.parent().parent().find(".mega-toggle-on").children("a.mega-menu-link").each(function() { // all open children of open siblings
|
66 |
plugin.hidePanel($(this), immediate);
|
@@ -509,6 +532,7 @@
|
|
509 |
plugin.reverseRightAlignedItems();
|
510 |
plugin.addClearClassesToMobileItems();
|
511 |
plugin.hideAllPanels();
|
|
|
512 |
};
|
513 |
|
514 |
plugin.initToggleBar = function() {
|
21 |
panel_inner_width: $menu.attr("data-panel-inner-width"),
|
22 |
mobile_force_width: $menu.attr("data-mobile-force-width"),
|
23 |
mobile_overlay: $menu.attr("data-mobile-overlay"),
|
24 |
+
mobile_state: $menu.attr("data-mobile-state"),
|
25 |
second_click: $menu.attr("data-second-click"),
|
26 |
vertical_behaviour: $menu.attr("data-vertical-behaviour"),
|
27 |
document_click: $menu.attr("data-document-click"),
|
62 |
});
|
63 |
};
|
64 |
|
65 |
+
plugin.expandMobileSubMenus = function() {
|
66 |
+
$(".mega-menu-item-has-children.mega-expand-on-mobile > a.mega-menu-link", $menu).each(function() {
|
67 |
+
plugin.showPanel($(this));
|
68 |
+
});
|
69 |
+
|
70 |
+
if ( plugin.settings.mobile_state == 'expand_all' ) {
|
71 |
+
$(".mega-menu-item-has-children > a.mega-menu-link", $menu).each(function() {
|
72 |
+
plugin.showPanel($(this));
|
73 |
+
});
|
74 |
+
}
|
75 |
+
|
76 |
+
if ( plugin.settings.mobile_state == 'expand_active' ) {
|
77 |
+
$("li.mega-current-menu-ancestor.mega-menu-item-has-children > a.mega-menu-link," +
|
78 |
+
"li.mega-current-menu-item.mega-menu-item-has-children > a.mega-menu-link" +
|
79 |
+
"li.mega-current-menu-parent.mega-menu-item-has-children > a.mega-menu-link" +
|
80 |
+
"li.mega-current_page_ancestor.mega-menu-item-has-children > a.mega-menu-link" +
|
81 |
+
"li.mega-current_page_item.mega-menu-item-has-children > a.mega-menu-link", $menu).each(function() {
|
82 |
+
plugin.showPanel($(this));
|
83 |
+
});
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
plugin.hideSiblingPanels = function(anchor, immediate) {
|
88 |
anchor.parent().parent().find(".mega-toggle-on").children("a.mega-menu-link").each(function() { // all open children of open siblings
|
89 |
plugin.hidePanel($(this), immediate);
|
532 |
plugin.reverseRightAlignedItems();
|
533 |
plugin.addClearClassesToMobileItems();
|
534 |
plugin.hideAllPanels();
|
535 |
+
plugin.expandMobileSubMenus();
|
536 |
};
|
537 |
|
538 |
plugin.initToggleBar = function() {
|
megamenu.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Max Mega Menu
|
4 |
* Plugin URI: https://www.megamenu.com
|
5 |
* Description: An easy to use mega menu plugin. Written the WordPress way.
|
6 |
-
* Version: 2.9.
|
7 |
* Author: megamenu.com
|
8 |
* Author URI: https://www.megamenu.com
|
9 |
* License: GPL-2.0+
|
@@ -35,7 +35,7 @@ if ( ! class_exists( 'Mega_Menu' ) ) :
|
|
35 |
*
|
36 |
* @var string
|
37 |
*/
|
38 |
-
public $version = '2.9.
|
39 |
|
40 |
|
41 |
/**
|
@@ -554,7 +554,7 @@ if ( ! class_exists( 'Mega_Menu' ) ) :
|
|
554 |
foreach ( $items as $item ) {
|
555 |
|
556 |
// populate standard (non-grid) sub menus.
|
557 |
-
if ( 0 === $item->depth && 'megamenu' === $item->megamenu_settings['type'] || ( 1 === $item->depth && 'tabbed' === $item->parent_submenu_type && 'grid' !== $item->megamenu_settings['type'] ) ) {
|
558 |
|
559 |
$panel_widgets = $widget_manager->get_widgets_for_menu_id( $item->ID, $args->menu );
|
560 |
|
@@ -607,7 +607,7 @@ if ( ! class_exists( 'Mega_Menu' ) ) :
|
|
607 |
}
|
608 |
|
609 |
// populate grid sub menus.
|
610 |
-
if ( 0 === $item->depth && 'grid' === $item->megamenu_settings['type'] || ( 1 === $item->depth && 'tabbed' === $item->parent_submenu_type && 'grid' === $item->megamenu_settings['type'] ) ) {
|
611 |
|
612 |
$saved_grid = $widget_manager->get_grid_widgets_and_menu_items_for_menu_id( $item->ID, $args->menu->term_id, $items );
|
613 |
|
@@ -863,7 +863,7 @@ if ( ! class_exists( 'Mega_Menu' ) ) :
|
|
863 |
}
|
864 |
|
865 |
// add parent mega menu type.
|
866 |
-
if ( absint( $item->depth ) === 1 ) {
|
867 |
$parent_settings = array_filter( (array) get_post_meta( $item->menu_item_parent, '_megamenu', true ) );
|
868 |
|
869 |
if ( isset( $parent_settings['type'] ) ) {
|
@@ -959,7 +959,7 @@ if ( ! class_exists( 'Mega_Menu' ) ) :
|
|
959 |
foreach ( $items as $item ) {
|
960 |
|
961 |
if ( ! in_array( 'menu-row', $item->classes, true ) && ! in_array( 'menu-column', $item->classes, true ) ) {
|
962 |
-
if ( 0 === $item->depth ) {
|
963 |
$item->classes[] = 'align-' . $item->megamenu_settings['align'];
|
964 |
$item->classes[] = 'menu-' . $item->megamenu_settings['type'];
|
965 |
}
|
@@ -1170,6 +1170,12 @@ if ( ! class_exists( 'Mega_Menu' ) ) :
|
|
1170 |
$effect_speed_mobile = 0;
|
1171 |
}
|
1172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1173 |
$hover_intent_params = apply_filters(
|
1174 |
'megamenu_javascript_localisation', // backwards compatiblity.
|
1175 |
array(
|
@@ -1196,6 +1202,7 @@ if ( ! class_exists( 'Mega_Menu' ) ) :
|
|
1196 |
'data-vertical-behaviour' => $vertical_behaviour,
|
1197 |
'data-breakpoint' => absint( $menu_theme['responsive_breakpoint'] ),
|
1198 |
'data-unbind' => 'disabled' === $unbind ? 'false' : 'true',
|
|
|
1199 |
'data-hover-intent-timeout' => absint( $hover_intent_params['timeout'] ),
|
1200 |
'data-hover-intent-interval' => absint( $hover_intent_params['interval'] ),
|
1201 |
),
|
3 |
* Plugin Name: Max Mega Menu
|
4 |
* Plugin URI: https://www.megamenu.com
|
5 |
* Description: An easy to use mega menu plugin. Written the WordPress way.
|
6 |
+
* Version: 2.9.2
|
7 |
* Author: megamenu.com
|
8 |
* Author URI: https://www.megamenu.com
|
9 |
* License: GPL-2.0+
|
35 |
*
|
36 |
* @var string
|
37 |
*/
|
38 |
+
public $version = '2.9.2';
|
39 |
|
40 |
|
41 |
/**
|
554 |
foreach ( $items as $item ) {
|
555 |
|
556 |
// populate standard (non-grid) sub menus.
|
557 |
+
if ( property_exists( $item, 'depth' ) && 0 === $item->depth && 'megamenu' === $item->megamenu_settings['type'] || ( property_exists( $item, 'depth' ) && 1 === $item->depth && 'tabbed' === $item->parent_submenu_type && 'grid' !== $item->megamenu_settings['type'] ) ) {
|
558 |
|
559 |
$panel_widgets = $widget_manager->get_widgets_for_menu_id( $item->ID, $args->menu );
|
560 |
|
607 |
}
|
608 |
|
609 |
// populate grid sub menus.
|
610 |
+
if ( property_exists( $item, 'depth' ) && 0 === $item->depth && 'grid' === $item->megamenu_settings['type'] || ( property_exists( $item, 'depth' ) && 1 === $item->depth && 'tabbed' === $item->parent_submenu_type && 'grid' === $item->megamenu_settings['type'] ) ) {
|
611 |
|
612 |
$saved_grid = $widget_manager->get_grid_widgets_and_menu_items_for_menu_id( $item->ID, $args->menu->term_id, $items );
|
613 |
|
863 |
}
|
864 |
|
865 |
// add parent mega menu type.
|
866 |
+
if ( property_exists( $item, 'depth' ) && absint( $item->depth ) === 1 ) {
|
867 |
$parent_settings = array_filter( (array) get_post_meta( $item->menu_item_parent, '_megamenu', true ) );
|
868 |
|
869 |
if ( isset( $parent_settings['type'] ) ) {
|
959 |
foreach ( $items as $item ) {
|
960 |
|
961 |
if ( ! in_array( 'menu-row', $item->classes, true ) && ! in_array( 'menu-column', $item->classes, true ) ) {
|
962 |
+
if ( property_exists( $item, 'depth' ) && 0 === $item->depth ) {
|
963 |
$item->classes[] = 'align-' . $item->megamenu_settings['align'];
|
964 |
$item->classes[] = 'menu-' . $item->megamenu_settings['type'];
|
965 |
}
|
1170 |
$effect_speed_mobile = 0;
|
1171 |
}
|
1172 |
|
1173 |
+
$mobile_state = 'collapse_all';
|
1174 |
+
|
1175 |
+
if ( isset( $menu_settings['mobile_state'] ) ) {
|
1176 |
+
$mobile_state = $menu_settings['mobile_state'];
|
1177 |
+
}
|
1178 |
+
|
1179 |
$hover_intent_params = apply_filters(
|
1180 |
'megamenu_javascript_localisation', // backwards compatiblity.
|
1181 |
array(
|
1202 |
'data-vertical-behaviour' => $vertical_behaviour,
|
1203 |
'data-breakpoint' => absint( $menu_theme['responsive_breakpoint'] ),
|
1204 |
'data-unbind' => 'disabled' === $unbind ? 'false' : 'true',
|
1205 |
+
'data-mobile-state' => $mobile_state,
|
1206 |
'data-hover-intent-timeout' => absint( $hover_intent_params['timeout'] ),
|
1207 |
'data-hover-intent-interval' => absint( $hover_intent_params['interval'] ),
|
1208 |
),
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Max Mega Menu ===
|
2 |
Contributors: megamenu
|
3 |
-
Tags: menu, megamenu, mega menu, navigation,
|
4 |
Requires at least: 4.9
|
5 |
-
Tested up to: 5.
|
6 |
-
Stable tag: 2.9.
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -134,6 +134,14 @@ See https://www.megamenu.com for more screenshots
|
|
134 |
|
135 |
== Changelog ==
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
= 2.9.1 =
|
138 |
|
139 |
* Fix: Error when clearing cache on some installations
|
1 |
=== Max Mega Menu ===
|
2 |
Contributors: megamenu
|
3 |
+
Tags: menu, megamenu, mega menu, navigation, mobile
|
4 |
Requires at least: 4.9
|
5 |
+
Tested up to: 5.6
|
6 |
+
Stable tag: 2.9.1
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
134 |
|
135 |
== Changelog ==
|
136 |
|
137 |
+
= 2.9.2 =
|
138 |
+
|
139 |
+
* New: Add Mobile Sub Menu Default State option to menu location settings
|
140 |
+
* New: Add support for 'expand-on-mobile' custom class to expand sub menu by default on mobile
|
141 |
+
* Fix: Theme export always exported the 'Default' theme
|
142 |
+
* Fix: Check depth property exists for compatibility with plugins that dynamically add items to the menu
|
143 |
+
* Improvement: Localise widget title string
|
144 |
+
|
145 |
= 2.9.1 =
|
146 |
|
147 |
* Fix: Error when clearing cache on some installations
|