Custom Menu Wizard Widget - Version 3.2.5

Version Description

  • addition : add cmw-menu-item-had-children class to any menu item that originally had children, regardless of whether it still does when output
Download this release

Release Info

Developer wizzud
Plugin Icon 128x128 Custom Menu Wizard Widget
Version 3.2.5
Comparing to
See all releases

Code changes from version 3.2.4 to 3.2.5

custom-menu-wizard.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Custom Menu Wizard
4
  * Plugin URI: http://wordpress.org/plugins/custom-menu-wizard/
5
  * Description: Show any part of a custom menu in a Widget, or in content using a Shortcode. Customise the output with extra classes or html; filter by current menu item or a specific item; set a depth, show the parent(s), change the list style, etc. Use the included emulator to assist with the filter settings.
6
- * Version: 3.2.4
7
  * Author: Roger Barrett
8
  * Author URI: http://www.wizzud.com/
9
  * License: GPL2+
@@ -11,6 +11,9 @@
11
  */
12
  defined( 'ABSPATH' ) or exit();
13
  /*
 
 
 
14
  * v3.2.4 change log
15
  * - changed the walker and the Assist to cope with negative ids on menu items
16
  * - added pre-sorting of menu items, to provide better handling of dynamically generated items by other plugins
@@ -180,7 +183,7 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
180
  //declare the main plugin class...
181
  class Custom_Menu_Wizard_Plugin {
182
 
183
- public static $version = '3.2.4';
184
  public static $script_handle = 'custom-menu-wizard-plugin-script';
185
  public static $widget_class = 'Custom_Menu_Wizard_Widget';
186
  protected static $instance;
3
  * Plugin Name: Custom Menu Wizard
4
  * Plugin URI: http://wordpress.org/plugins/custom-menu-wizard/
5
  * Description: Show any part of a custom menu in a Widget, or in content using a Shortcode. Customise the output with extra classes or html; filter by current menu item or a specific item; set a depth, show the parent(s), change the list style, etc. Use the included emulator to assist with the filter settings.
6
+ * Version: 3.2.5
7
  * Author: Roger Barrett
8
  * Author URI: http://www.wizzud.com/
9
  * License: GPL2+
11
  */
12
  defined( 'ABSPATH' ) or exit();
13
  /*
14
+ * v3.2.5 change log
15
+ * - added cmw-menu-item-had-children class to any menu item that originally had children, regardless of whether it still does when output
16
+ *
17
  * v3.2.4 change log
18
  * - changed the walker and the Assist to cope with negative ids on menu items
19
  * - added pre-sorting of menu items, to provide better handling of dynamically generated items by other plugins
183
  //declare the main plugin class...
184
  class Custom_Menu_Wizard_Plugin {
185
 
186
+ public static $version = '3.2.5';
187
  public static $script_handle = 'custom-menu-wizard-plugin-script';
188
  public static $widget_class = 'Custom_Menu_Wizard_Widget';
189
  protected static $instance;
doc/cmw-doc.html CHANGED
@@ -119,7 +119,7 @@ div > ul > li > ul, div > ol > li > ul {
119
  <p>
120
  <strong>Tested up to:</strong> 4.4</p>
121
  <p>
122
- <strong>Stable tag:</strong> 3.2.4</p>
123
  <p>
124
  <strong>License:</strong> GPLv2 or Later </p>
125
 
@@ -146,6 +146,10 @@ div > ul > li > ul, div > ol > li > ul {
146
  <p>This plugin is a boosted version of the WordPress "Custom Menu" widget.
147
  It provides full control over most of the parameters available when calling WP's <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu" target='_blank'>wp_nav_menu()<small class="glyphicon glyphicon-new-window offsite-link" aria-hidden="true"></small></a> function, as well as providing pre-filtering of the menu items in order to be able to select a specific portion of the custom menu. It also automatically adds a couple of custom classes. And there's a shortcode that enables you to include the widget's output in your content.</p>
148
 
 
 
 
 
149
  <p>Features include:</p>
150
 
151
  <ul>
@@ -755,14 +759,14 @@ in <a href="http://www.wizzud.com/2014/10/03/custom-menu-wizard-wordpress-plugin
755
 
756
  <p>The shortcode is <strong><code>[cmwizard]</code></strong>.
757
  Most of the attributes reflect the options available to the widget, but some have been simplified for easier use in the shortcode format.
758
- Please note that the <strong>Hide Widget if Empty</strong> option is not available to the shortcode : it is set to enabled, and if there are no menu items
759
- found then there will be no output from the shortcode.</p>
760
 
761
  <p>The simplest way to build a shortcode is to use a widget : as you set options, the equivalent shortcode is displayed at the base of
762
  the widget (v3+) and the base of the "assist". The widget itself need not be assigned to a widget area, so you can construct your
763
- shortcode using a widget in the Inactive Widgets area if you have no need for an active one. Please remember that any options you play
764
- with while constructing your shortcode <strong><em>do not have to be Saved</em></strong> to the widget itself! Just copy-paste the shortcode when
765
- you are happy with it.</p>
 
766
 
767
  <h4 id="sattribute-widget">widget</h4>
768
 
@@ -779,7 +783,7 @@ adding an <code>orphaned=1</code> attribute.</p>
779
 
780
  <p>Using this attribute reduces the shortcode length, and may cut down on maintenance where
781
  you have the same shortcode in a number of places ... as long as you are prepared to keep the widget instance (even if it's in the
782
- Inactive Widgets area). You can override the widget instance's settings by supplying any of the standard shortcode attributes.</p>
783
 
784
  <h4 id="sattribute-title">title</h4>
785
 
@@ -1140,8 +1144,8 @@ they're in a footer widget area or inserted within content (using a shortcode).<
1140
 
1141
  <pre><code>ul ul { margin-left: 1em; }</code></pre>
1142
 
1143
- <p>...however, I have found that things a generally never that straightforward, particularly when menus with
1144
- links in them are involved, so I'm afraid you might to have to experiment a bit.</p>
1145
 
1146
 
1147
  </div></div></div><div class="panel panel-info"><a class="panel-heading show" role="tab" id="faq-5-heading" data-toggle="collapse" href="#faq-5" aria-expanded="false" aria-controls="faq-5"><h4 class="panel-title"><span class="glyphicon glyphicon-triangle-bottom pull-right"></span><span class="glyphicon glyphicon-triangle-top pull-right"></span>How can I create a horizontal menu?</h4></a><div id="faq-5" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faq-5-heading"><div class="panel-body">
@@ -1300,7 +1304,13 @@ because Version 2 will <strong>not</strong> be supported beyond Version 3.</p>
1300
  </div></div></div></div> </div>
1301
  <div role="tabpanel" class="tab-pane fade" id="Changelog">
1302
  <h2>Changelog</h2>
1303
- <h4>3.2.4</h4>
 
 
 
 
 
 
1304
 
1305
  <ul>
1306
  <li>bugfix : improve handling of dynamically-generated items, by pre-sorting into menu_order order and coping with negative item ids</li>
119
  <p>
120
  <strong>Tested up to:</strong> 4.4</p>
121
  <p>
122
+ <strong>Stable tag:</strong> 3.2.5</p>
123
  <p>
124
  <strong>License:</strong> GPLv2 or Later </p>
125
 
146
  <p>This plugin is a boosted version of the WordPress "Custom Menu" widget.
147
  It provides full control over most of the parameters available when calling WP's <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu" target='_blank'>wp_nav_menu()<small class="glyphicon glyphicon-new-window offsite-link" aria-hidden="true"></small></a> function, as well as providing pre-filtering of the menu items in order to be able to select a specific portion of the custom menu. It also automatically adds a couple of custom classes. And there's a shortcode that enables you to include the widget's output in your content.</p>
148
 
149
+ <p><strong>Important!</strong> This plugin provides <strong><em>nothing</em></strong> - <em>zip, zilch, nada, bupkis</em> - in the way of frontend styling! The
150
+ appearance of any final output is down to you and your theme, so if you're just looking for something to re-style
151
+ a menu then I'm sorry but this plugin <em>won't do that</em>!</p>
152
+
153
  <p>Features include:</p>
154
 
155
  <ul>
759
 
760
  <p>The shortcode is <strong><code>[cmwizard]</code></strong>.
761
  Most of the attributes reflect the options available to the widget, but some have been simplified for easier use in the shortcode format.
762
+ If there are no menu items as a result of the filtering, then there will be no output from the shortcode.</p>
 
763
 
764
  <p>The simplest way to build a shortcode is to use a widget : as you set options, the equivalent shortcode is displayed at the base of
765
  the widget (v3+) and the base of the "assist". The widget itself need not be assigned to a widget area, so you can construct your
766
+ shortcode using a widget in the Inactive Widgets area if you have no need for an active one.</p>
767
+
768
+ <p>Note that as long as you are <strong>not</strong> using the <code>widget=N</code> attribute, then you don't need to save the widget itself :
769
+ just copy-paste the shortcode when you are happy with it.</p>
770
 
771
  <h4 id="sattribute-widget">widget</h4>
772
 
783
 
784
  <p>Using this attribute reduces the shortcode length, and may cut down on maintenance where
785
  you have the same shortcode in a number of places ... as long as you are prepared to keep the widget instance (even if it's in the
786
+ Inactive Widgets area). You can override the widget instance's settings by supplying any of the other standard shortcode attributes.</p>
787
 
788
  <h4 id="sattribute-title">title</h4>
789
 
1144
 
1145
  <pre><code>ul ul { margin-left: 1em; }</code></pre>
1146
 
1147
+ <p>...however, I have found that things are generally never that straightforward, particularly when menus with
1148
+ links in them are involved, so I'm afraid you might have to experiment a bit.</p>
1149
 
1150
 
1151
  </div></div></div><div class="panel panel-info"><a class="panel-heading show" role="tab" id="faq-5-heading" data-toggle="collapse" href="#faq-5" aria-expanded="false" aria-controls="faq-5"><h4 class="panel-title"><span class="glyphicon glyphicon-triangle-bottom pull-right"></span><span class="glyphicon glyphicon-triangle-top pull-right"></span>How can I create a horizontal menu?</h4></a><div id="faq-5" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faq-5-heading"><div class="panel-body">
1304
  </div></div></div></div> </div>
1305
  <div role="tabpanel" class="tab-pane fade" id="Changelog">
1306
  <h2>Changelog</h2>
1307
+ <h4>3.2.5</h4>
1308
+
1309
+ <ul>
1310
+ <li>addition : add cmw-menu-item-had-children class to any menu item that originally had children, regardless of whether it still does when output</li>
1311
+ </ul>
1312
+
1313
+ <h4>3.2.4</h4>
1314
 
1315
  <ul>
1316
  <li>bugfix : improve handling of dynamically-generated items, by pre-sorting into menu_order order and coping with negative item ids</li>
include/class.walker.php CHANGED
@@ -298,6 +298,10 @@ class Custom_Menu_Wizard_Walker extends Walker_Nav_Menu {
298
  $this->_cmw_tree[ $itemID ]['ancestors'][] = $parentID;
299
  //add this item to its parent's kids...
300
  $this->_cmw_tree[ $parentID ]['kids'][] = $itemID;
 
 
 
 
301
 
302
  //check for inheritance on items and exclude...
303
  if( isset( $inheritItems ) ){
298
  $this->_cmw_tree[ $itemID ]['ancestors'][] = $parentID;
299
  //add this item to its parent's kids...
300
  $this->_cmw_tree[ $parentID ]['kids'][] = $itemID;
301
+ //if this is the (non-root!) parent's first kid, give it (the parent) a had-kids class...
302
+ if( $parentID != 0 && count( $this->_cmw_tree[ $parentID ]['kids'] ) == 1 ){
303
+ $this->_cmw_tree[ $parentID ]['classes'][] = 'cmw-menu-item-had-children';
304
+ }
305
 
306
  //check for inheritance on items and exclude...
307
  if( isset( $inheritItems ) ){
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: menu,widget,navigation,custom menu,partial menu,current item,current page,menu level,menu branch,menu shortcode,menu widget,advanced,enhanced
5
  Requires at least: 3.6
6
  Tested up to: 4.4
7
- Stable tag: 3.2.4
8
  License: GPLv2 or Later
9
 
10
  Show branches or levels of your menu in a widget, or in content using a shortcode, with full customisation.
@@ -14,6 +14,10 @@ Show branches or levels of your menu in a widget, or in content using a shortcod
14
  This plugin is a boosted version of the WordPress "Custom Menu" widget.
15
  It provides full control over most of the parameters available when calling WP's [wp_nav_menu()](http://codex.wordpress.org/Function_Reference/wp_nav_menu) function, as well as providing pre-filtering of the menu items in order to be able to select a specific portion of the custom menu. It also automatically adds a couple of custom classes. And there's a shortcode that enables you to include the widget's output in your content.
16
 
 
 
 
 
17
  Features include:
18
 
19
  * Display an entire menu, just a branch of it, just certain level(s) of it, or even just specific items from it!
@@ -501,14 +505,14 @@ under [Other Notes](https://wordpress.org/plugins/custom-menu-wizard/other_notes
501
 
502
  The shortcode is **`[cmwizard]`**.
503
  Most of the attributes reflect the options available to the widget, but some have been simplified for easier use in the shortcode format.
504
- Please note that the **Hide Widget if Empty** option is not available to the shortcode : it is set to enabled, and if there are no menu items
505
- found then there will be no output from the shortcode.
506
 
507
  The simplest way to build a shortcode is to use a widget : as you set options, the equivalent shortcode is displayed at the base of
508
  the widget (v3+) and the base of the "assist". The widget itself need not be assigned to a widget area, so you can construct your
509
- shortcode using a widget in the Inactive Widgets area if you have no need for an active one. Please remember that any options you play
510
- with while constructing your shortcode ***do not have to be Saved*** to the widget itself! Just copy-paste the shortcode when
511
- you are happy with it.
 
512
 
513
  = widget =
514
  *integer* : **!NEW!** *from v3.1.5*, the shortcode will accept a `widget=N` attribute which will load an
@@ -524,7 +528,7 @@ adding an `orphaned=1` attribute.
524
 
525
  Using this attribute reduces the shortcode length, and may cut down on maintenance where
526
  you have the same shortcode in a number of places ... as long as you are prepared to keep the widget instance (even if it's in the
527
- Inactive Widgets area). You can override the widget instance's settings by supplying any of the standard shortcode attributes.
528
 
529
  = title =
530
  *string* : The output's `Title`, which may be overridden by **title_from**. Note that there is no shortcode equivalent of the widget's `Hide` option for the title.
@@ -821,8 +825,8 @@ Purely as an example, [re-]applying indentation to nested unorder lists (ULs) co
821
 
822
  `ul ul { margin-left: 1em; }`
823
 
824
- ...however, I have found that things a generally never that straightforward, particularly when menus with
825
- links in them are involved, so I'm afraid you might to have to experiment a bit.
826
 
827
  = How can I create a horizontal menu? =
828
  Firstly, see the answer above, re: styling of the output.
@@ -961,6 +965,9 @@ because Version 2 will **not** be supported beyond Version 3.
961
 
962
  == Changelog ==
963
 
 
 
 
964
  = 3.2.4 =
965
  * bugfix : improve handling of dynamically-generated items, by pre-sorting into menu_order order and coping with negative item ids
966
  * documentation : updated FAQs
@@ -1124,6 +1131,9 @@ because Version 2 will **not** be supported beyond Version 3.
1124
 
1125
  == Upgrade Notice ==
1126
 
 
 
 
1127
  = 3.2.4 =
1128
  Fix to improve handling of dynamically-generated items that have negative item ids, and that get appended to the list of items.
1129
  Updated FAQs documentation.
4
  Tags: menu,widget,navigation,custom menu,partial menu,current item,current page,menu level,menu branch,menu shortcode,menu widget,advanced,enhanced
5
  Requires at least: 3.6
6
  Tested up to: 4.4
7
+ Stable tag: 3.2.5
8
  License: GPLv2 or Later
9
 
10
  Show branches or levels of your menu in a widget, or in content using a shortcode, with full customisation.
14
  This plugin is a boosted version of the WordPress "Custom Menu" widget.
15
  It provides full control over most of the parameters available when calling WP's [wp_nav_menu()](http://codex.wordpress.org/Function_Reference/wp_nav_menu) function, as well as providing pre-filtering of the menu items in order to be able to select a specific portion of the custom menu. It also automatically adds a couple of custom classes. And there's a shortcode that enables you to include the widget's output in your content.
16
 
17
+ **Important!** This plugin provides ***nothing*** - *zip, zilch, nada, bupkis* - in the way of frontend styling! The
18
+ appearance of any final output is down to you and your theme, so if you're just looking for something to re-style
19
+ a menu then I'm sorry but this plugin *won't do that*!
20
+
21
  Features include:
22
 
23
  * Display an entire menu, just a branch of it, just certain level(s) of it, or even just specific items from it!
505
 
506
  The shortcode is **`[cmwizard]`**.
507
  Most of the attributes reflect the options available to the widget, but some have been simplified for easier use in the shortcode format.
508
+ If there are no menu items as a result of the filtering, then there will be no output from the shortcode.
 
509
 
510
  The simplest way to build a shortcode is to use a widget : as you set options, the equivalent shortcode is displayed at the base of
511
  the widget (v3+) and the base of the "assist". The widget itself need not be assigned to a widget area, so you can construct your
512
+ shortcode using a widget in the Inactive Widgets area if you have no need for an active one.
513
+
514
+ Note that as long as you are **not** using the `widget=N` attribute, then you don't need to save the widget itself :
515
+ just copy-paste the shortcode when you are happy with it.
516
 
517
  = widget =
518
  *integer* : **!NEW!** *from v3.1.5*, the shortcode will accept a `widget=N` attribute which will load an
528
 
529
  Using this attribute reduces the shortcode length, and may cut down on maintenance where
530
  you have the same shortcode in a number of places ... as long as you are prepared to keep the widget instance (even if it's in the
531
+ Inactive Widgets area). You can override the widget instance's settings by supplying any of the other standard shortcode attributes.
532
 
533
  = title =
534
  *string* : The output's `Title`, which may be overridden by **title_from**. Note that there is no shortcode equivalent of the widget's `Hide` option for the title.
825
 
826
  `ul ul { margin-left: 1em; }`
827
 
828
+ ...however, I have found that things are generally never that straightforward, particularly when menus with
829
+ links in them are involved, so I'm afraid you might have to experiment a bit.
830
 
831
  = How can I create a horizontal menu? =
832
  Firstly, see the answer above, re: styling of the output.
965
 
966
  == Changelog ==
967
 
968
+ = 3.2.5 =
969
+ * addition : add cmw-menu-item-had-children class to any menu item that originally had children, regardless of whether it still does when output
970
+
971
  = 3.2.4 =
972
  * bugfix : improve handling of dynamically-generated items, by pre-sorting into menu_order order and coping with negative item ids
973
  * documentation : updated FAQs
1131
 
1132
  == Upgrade Notice ==
1133
 
1134
+ = 3.2.5 =
1135
+ Adds cmw-menu-item-had-children class to any menu item that originally had children, regardless of whether it still does when output.
1136
+
1137
  = 3.2.4 =
1138
  Fix to improve handling of dynamically-generated items that have negative item ids, and that get appended to the list of items.
1139
  Updated FAQs documentation.