Version Description
- change : minimum WordPress version is now 3.9! (because require .dashicons-before, as part of needing to dump jQuery UI theme)
- bugfix : ! Possible Breaker ! fixed incorrect determination of current item when a "current menu item" has a duplicate of itself as an ancestor (hopefully rare). There is a (very slight) chance that this may affect your displayed menu : if it does, toggle the Fallback option for If more than 1 possible Current Item, and I apologise for not catching the problem earlier
- change : dumped jQuery UI's Smoothness theme for WordPress's own CSS, to work around styling issues with WP4.5
- change : removed the hide_empty option (only relevant pre WP3.6) entirely
- change : remove support for Widget Customizer plugin (part of core from WP3.9)
- change : localized all text used by assist, to reduce byte footprint of the widget
- add : in customizer, if there are no menus, link to the customizer's menus panel
- add : opt in to customizer selective refresh for widgets (WP4.5)
- bugfix : correction to regexps that sanitize the alternative
- bugfix : corrected some problems with the assist dialog's auto-sizing, particularly after dragging
- tweak : squidged the widget form a bit, to reduce byte footprint of the widget
- tweak : included screenshots in html version of documentation
Download this release
Release Info
Developer | wizzud |
Plugin | Custom Menu Wizard Widget |
Version | 3.3.0 |
Comparing to | |
See all releases |
Code changes from version 3.2.6 to 3.3.0
- custom-menu-wizard-330.png +0 -0
- custom-menu-wizard.css +44 -41
- custom-menu-wizard.js +248 -165
- custom-menu-wizard.min.js +59 -58
- custom-menu-wizard.php +65 -25
- custom-menu-wizard.png +0 -0
- doc/cmw-doc.html +174 -107
- include/class.walker.php +43 -8
- include/class.widget.php +311 -484
- readme.txt +69 -15
custom-menu-wizard-330.png
ADDED
Binary file
|
custom-menu-wizard.css
CHANGED
@@ -17,10 +17,10 @@
|
|
17 |
.widget-custom-menu-wizard-onchange .cmw-colour-grey,
|
18 |
.widget-custom-menu-wizard-onchange .cmw-colour-grey input,
|
19 |
.widget-custom-menu-wizard-onchange .cmw-colour-grey select,
|
20 |
-
.widget-custom-menu-wizard-onchange .cmw-colour-grey textarea {color:#7F7F7F}
|
21 |
.widget-custom-menu-wizard-onchange small.cmw-colour-grey {vertical-align:top;}
|
22 |
.widget-custom-menu-wizard-onchange .cmw-display-none {display:none;}
|
23 |
-
.widget-custom-menu-wizard-onchange .cmw-followed-by
|
24 |
.widget-custom-menu-wizard-onchange .cmw-indented {margin-left:1em; text-indent:-1em;}
|
25 |
.widget-custom-menu-wizard-onchange .cmw-maxwidth-twothirds {max-width:66% !important;}
|
26 |
.widget-custom-menu-wizard-onchange .cmw-mock-fieldset {border-top:1px solid #E5E5E5; color:#0074a2; font-weight:bold; line-height:1.7; margin:0.5em 0 0; padding:0.4em 0 0; text-transform:uppercase;}
|
@@ -32,23 +32,13 @@
|
|
32 |
.widget-custom-menu-wizard-onchange .cmw-whitespace-nowrap {white-space:nowrap;}
|
33 |
.widget-custom-menu-wizard-onchange .widget-custom-menu-wizard-assist {float:right; font-size:0.77em; height:auto; line-height:1.5; margin:-0.4em 0 0 1em; padding:0 1em;}
|
34 |
.widget-custom-menu-wizard-onchange .cmw-fieldset > div {margin:1em 0;}
|
35 |
-
a.widget-custom-menu-wizard-fieldset {
|
36 |
-
a.widget-custom-menu-wizard-fieldset:
|
37 |
-
a.widget-custom-menu-wizard-fieldset
|
38 |
-
a.widget-custom-menu-wizard-fieldset.cmw-collapsed-fieldset {background-position:100% 8px;}
|
39 |
-
a.widget-custom-menu-wizard-fieldset.cmw-collapsed-fieldset:hover,
|
40 |
-
a.widget-custom-menu-wizard-fieldset.cmw-collapsed-fieldset:active {background-position:100% -72px;}
|
41 |
.widget-custom-menu-wizard-onchange .cmw-start-fieldset-collapsed {display:none;}
|
42 |
-
/*...pre WP3.8...*/
|
43 |
-
.widget-custom-menu-wizard-onchange.cmw-pre-wp-v38 input[type="checkbox"],
|
44 |
-
.widget-custom-menu-wizard-onchange.cmw-pre-wp-v38 input[type="radio"] {margin-right:4px;}
|
45 |
-
.widget-custom-menu-wizard-onchange.cmw-pre-wp-v38 .cmw-fieldset {padding-top:1em;}
|
46 |
/*...accessibility...*/
|
47 |
-
.no-js a.widget-custom-menu-wizard-fieldset.cmw-collapsed-fieldset {background-position:100% -32px;}
|
48 |
-
.no-js a.widget-custom-menu-wizard-fieldset.cmw-collapsed-fieldset:hover,
|
49 |
-
.no-js a.widget-custom-menu-wizard-fieldset.cmw-collapsed-fieldset:active {background-position:100% -112px;}
|
50 |
.no-js .widget-custom-menu-wizard-onchange .cmw-start-fieldset-collapsed {display:block;}
|
51 |
-
.no-js a.widget-custom-menu-wizard-fieldset {
|
52 |
.no-js .widget-custom-menu-wizard-assist,
|
53 |
.js .widget-custom-menu-wizard-onchange .cmw-shortcode-nojs {display:none;}
|
54 |
/*...customizer tweaks...*/
|
@@ -67,7 +57,7 @@ a.widget-custom-menu-wizard-fieldset.cmw-collapsed-fieldset:active {background-p
|
|
67 |
.widget-custom-menu-wizard-onchange code {border:1px solid #CCCCCC; display:inline-block; line-height:1.5; padding:0.25em 0.5em;}
|
68 |
.widget-custom-menu-wizard-onchange code {padding:0.1em 0.2em; font-size:0.846em;}
|
69 |
/*dialog style...*/
|
70 |
-
.widget-custom-menu-wizard-dialog {
|
71 |
.widget-custom-menu-wizard-dialog .cmw-demo-themenu,
|
72 |
.widget-custom-menu-wizard-dialog .cmw-demo-themenu *,
|
73 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput,
|
@@ -76,11 +66,10 @@ a.widget-custom-menu-wizard-fieldset.cmw-collapsed-fieldset:active {background-p
|
|
76 |
.widget-custom-menu-wizard-dialog .cmw-demo-theshortcode * {position:relative;}
|
77 |
/*...fix for jquery UI's draggable problem in v1.10.3/4...*/
|
78 |
.cmw-assistance-dialog {position:absolute !important;}
|
79 |
-
.cmw-assistance-dialog
|
80 |
-
.cmw-assistance-dialog .cmw-dialog-fixed-absolute {
|
81 |
-
.cmw-assistance-dialog .cmw-dialog-fixed-absolute .
|
82 |
-
.cmw-assistance-dialog .
|
83 |
-
.cmw-assistance-dialog .ui-dialog-title {width:65% !important;}
|
84 |
/*...for customizer, make sure the assist goes above .wp-full-overlay, and for WP4.1 it needs to go above sidebar, so do regardless...*/
|
85 |
.ui-front.cmw-assistance-dialog {z-index:600000;}
|
86 |
/*...menu...*/
|
@@ -98,36 +87,42 @@ a.widget-custom-menu-wizard-fieldset.cmw-collapsed-fieldset:active {background-p
|
|
98 |
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul .current-menu-parent {border-color:#ff9900 !important; background-image:-webkit-gradient(linear, left top, left bottom, from(rgba(255, 204, 153, 0.7)), to(rgba(255, 204, 153, 0))); background-image:-webkit-linear-gradient(top, rgba(255, 204, 153, 0.7), rgba(255, 204, 153, 0)); background-image:-moz-linear-gradient(top, rgba(255, 204, 153, 0.7), rgba(255, 204, 153, 0)); background-image:-ms-linear-gradient(top, rgba(255, 204, 153, 0.7), rgba(255, 204, 153, 0)); background-image:-o-linear-gradient(top, rgba(255, 204, 153, 0.7), rgba(255, 204, 153, 0)); background-image:linear-gradient(to bottom, rgba(255, 204, 153, 0.7), rgba(255, 204, 153, 0)); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#b2ffcc99, endColorstr=#01ffcc99); -ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#b2ffcc99, endColorstr=#01ffcc99)";}
|
99 |
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul a.cmw-item {color:#000000; margin:1px; padding:2px;}
|
100 |
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul .picked > a.cmw-item {background-color:#333366; color:#ffffff;}
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
/*...ticks/crosses...*/
|
102 |
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul a.cmw-tick,
|
103 |
-
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul a.cmw-cross {background:transparent url("custom-menu-wizard.png") no-repeat 0
|
104 |
-
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul a.cmw-tick {background-position:0 -
|
105 |
.widget-custom-menu-wizard-dialog .cmw-demo-filteritems a.cmw-tick {visibility:visible;}
|
106 |
.widget-custom-menu-wizard-dialog .cmw-version-210 a.cmw-cross {display:none;}
|
107 |
.widget-custom-menu-wizard-dialog .cmw-has-cross > a.cmw-cross,
|
108 |
-
.widget-custom-menu-wizard-dialog .cmw-has-cross.cmw-inherit-cross a.cmw-cross {background-position:0 -
|
109 |
-
.widget-custom-menu-wizard-dialog .cmw-has-cross.cmw-inherit-cross > a.cmw-cross {background-position:0 -
|
110 |
-
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul a.cmw-cross:hover {background-position:0 -
|
111 |
.widget-custom-menu-wizard-dialog .cmw-has-cross > a.cmw-cross:hover,
|
112 |
-
.widget-custom-menu-wizard-dialog .cmw-has-cross.cmw-inherit-cross a.cmw-cross:hover {background-position:0 -
|
113 |
-
.widget-custom-menu-wizard-dialog .cmw-has-cross.cmw-inherit-cross > a.cmw-cross:hover {background-position:0 -
|
114 |
.widget-custom-menu-wizard-dialog .cmw-has-tick > a.cmw-tick,
|
115 |
-
.widget-custom-menu-wizard-dialog .cmw-has-tick.cmw-inherit-tick a.cmw-tick {background-position:0 -
|
116 |
-
.widget-custom-menu-wizard-dialog .cmw-has-tick.cmw-inherit-tick > a.cmw-tick {background-position:0 -
|
117 |
-
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul a.cmw-tick:hover {background-position:0 -
|
118 |
.widget-custom-menu-wizard-dialog .cmw-has-tick > a.cmw-tick:hover,
|
119 |
-
.widget-custom-menu-wizard-dialog .cmw-has-tick.cmw-inherit-tick a.cmw-tick:hover {background-position:0 -
|
120 |
-
.widget-custom-menu-wizard-dialog .cmw-has-tick.cmw-inherit-tick > a.cmw-tick:hover {background-position:0 -
|
121 |
.widget-custom-menu-wizard-dialog .cmw-using-alternative .cmw-tick,
|
122 |
.widget-custom-menu-wizard-dialog .cmw-using-alternative .cmw-cross {opacity:0.5;}
|
123 |
/*...expanders...*/
|
124 |
-
.widget-custom-menu-wizard-dialog .widget-custom-menu-wizard-colexp {position:absolute; top:0.
|
125 |
-
.widget-custom-menu-wizard-dialog .widget-custom-menu-wizard-colexp.
|
126 |
/*...output...*/
|
127 |
-
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput {float:right; margin:0 0
|
128 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput h3 {border-bottom:1px solid #CCCCCC; font-size:1.1667em; margin:0.25em 0; padding: 0 0.857em 0.25em 0.643em;}
|
129 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput h3.cmw-title-linked {cursor:pointer; text-decoration:underline;}
|
130 |
-
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput-wrap {border:1px solid #cccccc; margin:0.5em 0; min-height:
|
131 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput-wrap {border-left:4px solid #2ea2cc;}
|
132 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput-wrap ul,
|
133 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput-wrap ol {margin:0.5em 1em 0.5em 2em; padding:0;}
|
@@ -160,18 +155,18 @@ a.widget-custom-menu-wizard-fieldset.cmw-collapsed-fieldset:active {background-p
|
|
160 |
.widget-custom-menu-wizard-dialog .cmw-demo-exclusions.updated,
|
161 |
.widget-custom-menu-wizard-dialog .cmw-demo-alternative.updated,
|
162 |
.widget-custom-menu-wizard-dialog .cmw-demo-fallback.updated {display:block;}
|
163 |
-
.widget-custom-menu-wizard-dialog span.spinner {display:none; float:none;}
|
164 |
/*...find shortcodes...*/
|
165 |
.widget-custom-menu-wizard-find-shortcodes {overflow:hidden; text-align:center; width:50px;}
|
166 |
.widget-custom-menu-wizard-find-shortcodes span {display:block;}
|
167 |
-
.
|
|
|
168 |
.widget-custom-menu-wizard-dialog .cmw-find-shortcodes {position:absolute; right:0; top:-3em; z-index:10;}
|
169 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-shortcodes {background-color:#FFFFFF; border:1px solid #666666; box-shadow:2px 2px 2px #666666; margin:0; max-width:70%; min-width:10em; opacity:0; padding:0 0 1px; position:absolute; right:5000px; top:-1000px;}
|
170 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-shortcodes {border-right:4px solid #2EA2CC; -webkit-transition:opacity 1s linear 0s, right 0s linear 1s, top 0s linear 1s; -moz-transition:opacity 1s linear 0s, right 0s linear 1s, top 0s linear 1s; -o-transition:opacity 1s linear 0s, right 0s linear 1s, top 0s linear 1s; transition:opacity 1s linear 0s, right 0s linear 1s, top 0s linear 1s;}
|
171 |
.widget-custom-menu-wizard-dialog .cmw-ajax-showing .cmw-demo-found-shortcodes {opacity:1;}
|
172 |
.widget-custom-menu-wizard-dialog .cmw-ajax-showing .cmw-demo-found-shortcodes,
|
173 |
.widget-custom-menu-wizard-dialog .cmw-ajax-fetching .cmw-demo-found-shortcodes {right:60px; top:-4em;}
|
174 |
-
.widget-custom-menu-wizard-dialog .cmw-ajax-fetching span.spinner {display:block !important;}
|
175 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-shortcodes p {font-size:inherit; font-style:italic; margin:1em;}
|
176 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-shortcodes dl {border:0 none; margin:0.5em 0; padding:0;}
|
177 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-shortcodes a {display:block; overflow:hidden; padding:0 1em; text-overflow:ellipsis; white-space:nowrap;}
|
@@ -180,3 +175,11 @@ a.widget-custom-menu-wizard-fieldset.cmw-collapsed-fieldset:active {background-p
|
|
180 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-old {display:block; font-style:normal; padding:0; margin:2px 0;}
|
181 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-new {border-color:#ffffff; border-left:4px solid #ffffff;}
|
182 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-old {border-color:#DD3D36; border-left:4px solid #DD3D36;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
.widget-custom-menu-wizard-onchange .cmw-colour-grey,
|
18 |
.widget-custom-menu-wizard-onchange .cmw-colour-grey input,
|
19 |
.widget-custom-menu-wizard-onchange .cmw-colour-grey select,
|
20 |
+
.widget-custom-menu-wizard-onchange .cmw-colour-grey textarea {color:#7F7F7F;}
|
21 |
.widget-custom-menu-wizard-onchange small.cmw-colour-grey {vertical-align:top;}
|
22 |
.widget-custom-menu-wizard-onchange .cmw-display-none {display:none;}
|
23 |
+
.widget-custom-menu-wizard-onchange .cmw-followed-by::after {content:""; display:inline-block; width:1em;}
|
24 |
.widget-custom-menu-wizard-onchange .cmw-indented {margin-left:1em; text-indent:-1em;}
|
25 |
.widget-custom-menu-wizard-onchange .cmw-maxwidth-twothirds {max-width:66% !important;}
|
26 |
.widget-custom-menu-wizard-onchange .cmw-mock-fieldset {border-top:1px solid #E5E5E5; color:#0074a2; font-weight:bold; line-height:1.7; margin:0.5em 0 0; padding:0.4em 0 0; text-transform:uppercase;}
|
32 |
.widget-custom-menu-wizard-onchange .cmw-whitespace-nowrap {white-space:nowrap;}
|
33 |
.widget-custom-menu-wizard-onchange .widget-custom-menu-wizard-assist {float:right; font-size:0.77em; height:auto; line-height:1.5; margin:-0.4em 0 0 1em; padding:0 1em;}
|
34 |
.widget-custom-menu-wizard-onchange .cmw-fieldset > div {margin:1em 0;}
|
35 |
+
a.widget-custom-menu-wizard-fieldset {border-bottom:1px solid #E5E5E5; border-top:1px solid #E5E5E5; display:block; font-weight:bold; line-height:2.5; margin:0.5em 0 0; position:relative; text-decoration:none; text-transform:uppercase; width:100%;}
|
36 |
+
a.widget-custom-menu-wizard-fieldset::before {content:"\f142"; float:right; position:relative; top:5px;}
|
37 |
+
a.widget-custom-menu-wizard-fieldset.cmw-collapsed-fieldset::before {content:"\f140";}
|
|
|
|
|
|
|
38 |
.widget-custom-menu-wizard-onchange .cmw-start-fieldset-collapsed {display:none;}
|
|
|
|
|
|
|
|
|
39 |
/*...accessibility...*/
|
|
|
|
|
|
|
40 |
.no-js .widget-custom-menu-wizard-onchange .cmw-start-fieldset-collapsed {display:block;}
|
41 |
+
.no-js a.widget-custom-menu-wizard-fieldset::before {color:#444; content:"\f140";}
|
42 |
.no-js .widget-custom-menu-wizard-assist,
|
43 |
.js .widget-custom-menu-wizard-onchange .cmw-shortcode-nojs {display:none;}
|
44 |
/*...customizer tweaks...*/
|
57 |
.widget-custom-menu-wizard-onchange code {border:1px solid #CCCCCC; display:inline-block; line-height:1.5; padding:0.25em 0.5em;}
|
58 |
.widget-custom-menu-wizard-onchange code {padding:0.1em 0.2em; font-size:0.846em;}
|
59 |
/*dialog style...*/
|
60 |
+
.widget-custom-menu-wizard-dialog {line-height:1.4;}
|
61 |
.widget-custom-menu-wizard-dialog .cmw-demo-themenu,
|
62 |
.widget-custom-menu-wizard-dialog .cmw-demo-themenu *,
|
63 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput,
|
66 |
.widget-custom-menu-wizard-dialog .cmw-demo-theshortcode * {position:relative;}
|
67 |
/*...fix for jquery UI's draggable problem in v1.10.3/4...*/
|
68 |
.cmw-assistance-dialog {position:absolute !important;}
|
69 |
+
.cmw-assistance-dialog-fixed {position:fixed !important;}
|
70 |
+
.cmw-assistance-dialog .cmw-dialog-fixed-absolute {font-weight:normal; padding-left:6px; position:absolute; right:45px; top:4px;}
|
71 |
+
.cmw-assistance-dialog .cmw-dialog-fixed-absolute .dashicons-before::before {line-height:inherit;}
|
72 |
+
.cmw-assistance-dialog .ui-dialog-title {display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; width:65% !important;}
|
|
|
73 |
/*...for customizer, make sure the assist goes above .wp-full-overlay, and for WP4.1 it needs to go above sidebar, so do regardless...*/
|
74 |
.ui-front.cmw-assistance-dialog {z-index:600000;}
|
75 |
/*...menu...*/
|
87 |
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul .current-menu-parent {border-color:#ff9900 !important; background-image:-webkit-gradient(linear, left top, left bottom, from(rgba(255, 204, 153, 0.7)), to(rgba(255, 204, 153, 0))); background-image:-webkit-linear-gradient(top, rgba(255, 204, 153, 0.7), rgba(255, 204, 153, 0)); background-image:-moz-linear-gradient(top, rgba(255, 204, 153, 0.7), rgba(255, 204, 153, 0)); background-image:-ms-linear-gradient(top, rgba(255, 204, 153, 0.7), rgba(255, 204, 153, 0)); background-image:-o-linear-gradient(top, rgba(255, 204, 153, 0.7), rgba(255, 204, 153, 0)); background-image:linear-gradient(to bottom, rgba(255, 204, 153, 0.7), rgba(255, 204, 153, 0)); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#b2ffcc99, endColorstr=#01ffcc99); -ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#b2ffcc99, endColorstr=#01ffcc99)";}
|
88 |
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul a.cmw-item {color:#000000; margin:1px; padding:2px;}
|
89 |
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul .picked > a.cmw-item {background-color:#333366; color:#ffffff;}
|
90 |
+
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul .cmw-item strong {font-weight:normal;}
|
91 |
+
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul .cmw-item-extra {display:none; font-size:0.923em; font-weight:normal; line-height:1; text-align:right;}
|
92 |
+
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul .cmw-item-extra i {float:left; margin-right:1em;}
|
93 |
+
.widget-custom-menu-wizard-dialog.cmw-show-item-extras .cmw-demo-themenu-ul .cmw-item-extra {display:block;}
|
94 |
+
.widget-custom-menu-wizard-dialog.cmw-show-item-extras .cmw-demo-themenu-ul .cmw-item span {font-weight:bold; height:2.75em; line-height:1.55em; text-align:left; width:12em;}
|
95 |
+
.widget-custom-menu-wizard-dialog.cmw-show-item-extras .cmw-demo-themenu-ul .cmw-item strong {font-weight:bold;}
|
96 |
/*...ticks/crosses...*/
|
97 |
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul a.cmw-tick,
|
98 |
+
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul a.cmw-cross {background:transparent url("custom-menu-wizard-330.png") no-repeat 0 0px; height:20px; margin:3px 2px 0px 0px; position:relative; -webkit-transition-duration:0s; transition-duration:0s; width:20px;}
|
99 |
+
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul a.cmw-tick {background-position:0 -80px; margin-left:2px; margin-right:0; visibility:hidden;}
|
100 |
.widget-custom-menu-wizard-dialog .cmw-demo-filteritems a.cmw-tick {visibility:visible;}
|
101 |
.widget-custom-menu-wizard-dialog .cmw-version-210 a.cmw-cross {display:none;}
|
102 |
.widget-custom-menu-wizard-dialog .cmw-has-cross > a.cmw-cross,
|
103 |
+
.widget-custom-menu-wizard-dialog .cmw-has-cross.cmw-inherit-cross a.cmw-cross {background-position:0 -40px;}
|
104 |
+
.widget-custom-menu-wizard-dialog .cmw-has-cross.cmw-inherit-cross > a.cmw-cross {background-position:0 -160px;}
|
105 |
+
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul a.cmw-cross:hover {background-position:0 -20px;}
|
106 |
.widget-custom-menu-wizard-dialog .cmw-has-cross > a.cmw-cross:hover,
|
107 |
+
.widget-custom-menu-wizard-dialog .cmw-has-cross.cmw-inherit-cross a.cmw-cross:hover {background-position:0 -60px;}
|
108 |
+
.widget-custom-menu-wizard-dialog .cmw-has-cross.cmw-inherit-cross > a.cmw-cross:hover {background-position:0 -200px;}
|
109 |
.widget-custom-menu-wizard-dialog .cmw-has-tick > a.cmw-tick,
|
110 |
+
.widget-custom-menu-wizard-dialog .cmw-has-tick.cmw-inherit-tick a.cmw-tick {background-position:0 -120px;}
|
111 |
+
.widget-custom-menu-wizard-dialog .cmw-has-tick.cmw-inherit-tick > a.cmw-tick {background-position:0 -180px;}
|
112 |
+
.widget-custom-menu-wizard-dialog .cmw-demo-themenu-ul a.cmw-tick:hover {background-position:0 -100px;}
|
113 |
.widget-custom-menu-wizard-dialog .cmw-has-tick > a.cmw-tick:hover,
|
114 |
+
.widget-custom-menu-wizard-dialog .cmw-has-tick.cmw-inherit-tick a.cmw-tick:hover {background-position:0 -140px;}
|
115 |
+
.widget-custom-menu-wizard-dialog .cmw-has-tick.cmw-inherit-tick > a.cmw-tick:hover {background-position:0 -220px;}
|
116 |
.widget-custom-menu-wizard-dialog .cmw-using-alternative .cmw-tick,
|
117 |
.widget-custom-menu-wizard-dialog .cmw-using-alternative .cmw-cross {opacity:0.5;}
|
118 |
/*...expanders...*/
|
119 |
+
.widget-custom-menu-wizard-dialog .widget-custom-menu-wizard-colexp {position:absolute; top:0.25em; -webkit-transition-duration:0s; transition-duration:0s;}
|
120 |
+
.widget-custom-menu-wizard-dialog .widget-custom-menu-wizard-colexp.dashicons-arrow-right {opacity:0.4;}
|
121 |
/*...output...*/
|
122 |
+
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput {float:right; margin:0 0 6.5em 0.5em;}
|
123 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput h3 {border-bottom:1px solid #CCCCCC; font-size:1.1667em; margin:0.25em 0; padding: 0 0.857em 0.25em 0.643em;}
|
124 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput h3.cmw-title-linked {cursor:pointer; text-decoration:underline;}
|
125 |
+
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput-wrap {border:1px solid #cccccc; margin:0.5em 0; min-height:2.5em; min-width:10em; padding:0 0 1px;}
|
126 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput-wrap {border-left:4px solid #2ea2cc;}
|
127 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput-wrap ul,
|
128 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput-wrap ol {margin:0.5em 1em 0.5em 2em; padding:0;}
|
155 |
.widget-custom-menu-wizard-dialog .cmw-demo-exclusions.updated,
|
156 |
.widget-custom-menu-wizard-dialog .cmw-demo-alternative.updated,
|
157 |
.widget-custom-menu-wizard-dialog .cmw-demo-fallback.updated {display:block;}
|
|
|
158 |
/*...find shortcodes...*/
|
159 |
.widget-custom-menu-wizard-find-shortcodes {overflow:hidden; text-align:center; width:50px;}
|
160 |
.widget-custom-menu-wizard-find-shortcodes span {display:block;}
|
161 |
+
.widget-custom-menu-wizard-find-shortcodes span.spinner {display:none; float:none; margin:0 0 2px; visibility:visible;}
|
162 |
+
.cmw-ajax-showing .widget-custom-menu-wizard-find-shortcodes::after {background-color:#CC0000; content:""; display:block; height:2px; left:10%; position:absolute; top:50%; -webkit-transform:skew(0deg,-20deg); -ms-transform:skew(0deg,-20deg); -o-transform:skew(0deg,-20deg); transform:skew(0deg,-20deg); width:80%;}
|
163 |
.widget-custom-menu-wizard-dialog .cmw-find-shortcodes {position:absolute; right:0; top:-3em; z-index:10;}
|
164 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-shortcodes {background-color:#FFFFFF; border:1px solid #666666; box-shadow:2px 2px 2px #666666; margin:0; max-width:70%; min-width:10em; opacity:0; padding:0 0 1px; position:absolute; right:5000px; top:-1000px;}
|
165 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-shortcodes {border-right:4px solid #2EA2CC; -webkit-transition:opacity 1s linear 0s, right 0s linear 1s, top 0s linear 1s; -moz-transition:opacity 1s linear 0s, right 0s linear 1s, top 0s linear 1s; -o-transition:opacity 1s linear 0s, right 0s linear 1s, top 0s linear 1s; transition:opacity 1s linear 0s, right 0s linear 1s, top 0s linear 1s;}
|
166 |
.widget-custom-menu-wizard-dialog .cmw-ajax-showing .cmw-demo-found-shortcodes {opacity:1;}
|
167 |
.widget-custom-menu-wizard-dialog .cmw-ajax-showing .cmw-demo-found-shortcodes,
|
168 |
.widget-custom-menu-wizard-dialog .cmw-ajax-fetching .cmw-demo-found-shortcodes {right:60px; top:-4em;}
|
169 |
+
.widget-custom-menu-wizard-dialog .cmw-ajax-fetching span.spinner {display:inline-block !important;}
|
170 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-shortcodes p {font-size:inherit; font-style:italic; margin:1em;}
|
171 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-shortcodes dl {border:0 none; margin:0.5em 0; padding:0;}
|
172 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-shortcodes a {display:block; overflow:hidden; padding:0 1em; text-overflow:ellipsis; white-space:nowrap;}
|
175 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-old {display:block; font-style:normal; padding:0; margin:2px 0;}
|
176 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-new {border-color:#ffffff; border-left:4px solid #ffffff;}
|
177 |
.widget-custom-menu-wizard-dialog .cmw-demo-found-old {border-color:#DD3D36; border-left:4px solid #DD3D36;}
|
178 |
+
/*...toggle item extras...*/
|
179 |
+
.widget-custom-menu-wizard-dialog .cmw-toggle-item-extras {position:absolute; right:0; top:-6em;}
|
180 |
+
.widget-custom-menu-wizard-dialog .cmw-toggle-item-extras span {display:block;}
|
181 |
+
.widget-custom-menu-wizard-dialog .cmw-toggle-item-extras span:last-child,
|
182 |
+
.widget-custom-menu-wizard-dialog.cmw-show-item-extras .cmw-toggle-item-extras span:first-child {display:none;}
|
183 |
+
.widget-custom-menu-wizard-dialog.cmw-show-item-extras .cmw-toggle-item-extras span:last-child {display:block;}
|
184 |
+
/*...general...*/
|
185 |
+
.widget-custom-menu-wizard-dialog .cmw-corners {border-radius:4px;}
|
custom-menu-wizard.js
CHANGED
@@ -4,14 +4,18 @@
|
|
4 |
* to avoid Google Close Compiler producing a "Misplaced function annotation" warning!
|
5 |
*/
|
6 |
/*global jQuery, window, document, ajaxurl */
|
7 |
-
/*jslint
|
8 |
-
/*jshint curly: true, eqeqeq: true,
|
9 |
jQuery(function($){
|
10 |
'use strict';
|
11 |
var cmwAssist,
|
12 |
//only test for : key="value", key='value' and key=value...
|
13 |
parseSwitchTo = /(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)/g,
|
14 |
|
|
|
|
|
|
|
|
|
15 |
isNumeric = function(x){
|
16 |
return (/^[+\-]?\d+$/).test(x.toString());
|
17 |
},
|
@@ -26,7 +30,7 @@ jQuery(function($){
|
|
26 |
* @this {element} div.widget-custom-menu-wizard-onchange
|
27 |
* @param {object} e Event object
|
28 |
*/
|
29 |
-
var v = $(this).data().
|
30 |
v = /^\d+$/.test(v) ? 'v' + v : v;
|
31 |
//run the update() method of the relevant assist object, based on a version number...
|
32 |
if(cmwAssist[v]){
|
@@ -44,23 +48,20 @@ jQuery(function($){
|
|
44 |
* @return {object} key=>value pairs of the field element values
|
45 |
*/
|
46 |
var useAlternative = oc === false,
|
47 |
-
ocd = useAlternative ? {} : oc.data(),
|
48 |
settings = {},
|
49 |
-
legacyVersion = !useAlternative &&
|
50 |
csv = {items:1, exclude:1},
|
51 |
keepAsString = $.extend({branch_start:1, exclude_level:1, include_level:1}, csv);
|
52 |
-
$.each(useAlternative ? altFields : oc.find(':input').serializeArray(), function(
|
53 |
var name = v.name.replace(/.*\[([^\]]+)\]$/, '$1'),
|
54 |
-
val = !keepAsString[name] && /^-?\d
|
55 |
settings[name] = val;
|
56 |
-
if(name
|
57 |
-
settings[name] =
|
58 |
-
}else if(csv[name]){
|
59 |
-
settings['_' + name + '_sep'] = !val || /(^-?\d+\+?$|,)/.test($.trim(val)) ? ',' : ' ';
|
60 |
val = $.map(val.split(/[,\s]+/), function(x){
|
61 |
-
var inherit = !legacyVersion &&
|
62 |
x = x ? parseInt(x, 10) : 0;
|
63 |
-
return isNaN(x) || !x ? null : (inherit ? x + '+' : x);
|
64 |
});
|
65 |
settings['_' + name] = val.join(settings['_' + name + '_sep']);
|
66 |
}
|
@@ -123,7 +124,7 @@ jQuery(function($){
|
|
123 |
i = 0,
|
124 |
byItems, byBranch, byLevel, n;
|
125 |
while(attribute){
|
126 |
-
i
|
127 |
// key = "value" [1] [2] ...
|
128 |
if(attribute[1]){
|
129 |
attr[ attribute[1] ] = attribute[2];
|
@@ -134,16 +135,14 @@ jQuery(function($){
|
|
134 |
}else if(attribute[5]){
|
135 |
attr[ attribute[5] ] = attribute[6];
|
136 |
}else{
|
137 |
-
i
|
138 |
}
|
139 |
attribute = parseSwitchTo.exec(switchTo);
|
140 |
}
|
141 |
if(i){
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
}
|
146 |
-
}
|
147 |
}
|
148 |
|
149 |
//in order of priority...
|
@@ -222,7 +221,7 @@ jQuery(function($){
|
|
222 |
if( n.indexOf(' +siblings ') >= 0){
|
223 |
alts.fallback_siblings = 1;
|
224 |
}
|
225 |
-
for(i = 0; i < attr.length; i
|
226 |
if(/^\d+$/.test(attr[i])){
|
227 |
n = parseInt(attr[i], 10);
|
228 |
if(n > 0){
|
@@ -236,7 +235,7 @@ jQuery(function($){
|
|
236 |
//title_from => title_...
|
237 |
if(alts.title_from){
|
238 |
attr = alts.title_from.toLowerCase().split(/[\s,]+/);
|
239 |
-
for(i = 0; i < attr.length; i
|
240 |
if(attr[i]){
|
241 |
if(attr[i] === 'branch' || attr[i] === 'current'){
|
242 |
alts['title_' + attr[i]] = '0';
|
@@ -259,7 +258,6 @@ jQuery(function($){
|
|
259 |
}
|
260 |
}
|
261 |
alts.title_from = null;
|
262 |
-
alts.hide_empty = 1;
|
263 |
|
264 |
return getSettings( false, $.map(alts, function(v, k){ return v === null ? v : {name:k, value:v}; }) );
|
265 |
}, //end alternativeParse()
|
@@ -276,8 +274,9 @@ jQuery(function($){
|
|
276 |
rtn = x.replace(/[\r\n\t]+/g, ' ').replace(/^[\[\s]+/, '').replace(/[\s\/\]]+$/, '').split(/[\[\]]/)[0];
|
277 |
//trim trailing slash, surrounding spaces, and append a space...
|
278 |
rtn = $.trim(rtn.replace(/\/+$/, '')) + ' ';
|
279 |
-
//remove leading cmwizard, any occurrence of menu=something, and any occurrence of alternative="something" (optional quotes)...
|
280 |
-
rtn =
|
|
|
281 |
//remove multiple spaces...
|
282 |
rtn = rtn.replace(/\s\s+/g, ' ');
|
283 |
}
|
@@ -317,12 +316,13 @@ jQuery(function($){
|
|
317 |
* @param {string} tickOrCross Either 'tick' or 'cross'
|
318 |
* @return {object} jQuery of filtered items
|
319 |
*/
|
320 |
-
var sep = tickOrCross === 'tick' ?
|
321 |
inheritance = [],
|
322 |
haystack = tickOrCross === 'tick' ? '_items' : '_exclude';
|
|
|
323 |
haystack = settings[haystack]
|
324 |
-
|
325 |
-
|
326 |
if(/\+$/.test(v)){
|
327 |
inheritance.push(parseInt(v, 10));
|
328 |
return !v;
|
@@ -373,7 +373,7 @@ jQuery(function($){
|
|
373 |
i;
|
374 |
k = k ? [parseInt(k[1], 10), k[2] || ''] : [];
|
375 |
if(k[0] > 0){
|
376 |
-
for(i = 1; i <= maxLevel; i
|
377 |
if( i === k[0] || (k[1] === '-' && i < k[0]) || (k[1] === '+' && i > k[0]) ){
|
378 |
rtn.push('.level-' + i);
|
379 |
}
|
@@ -399,7 +399,7 @@ jQuery(function($){
|
|
399 |
itemList = {};
|
400 |
if(items.length && output.length){
|
401 |
//determine title: update() might have set a class for it...
|
402 |
-
title = topOfMenu.find('.title-from-item').children('.cmw-item').text() || '';
|
403 |
titleLinked = !!title && !!settings.title_linked;
|
404 |
//...otherwise, check the actual widget title...
|
405 |
if(!title && !settings.hide_title){
|
@@ -415,9 +415,9 @@ jQuery(function($){
|
|
415 |
anchor = self.children('.cmw-item');
|
416 |
if(!settings.flat_output){
|
417 |
itemList[iid] = 1;
|
418 |
-
for(i = 0; i < trace.length; i
|
419 |
if(itemList[trace[i]]){
|
420 |
-
level
|
421 |
}
|
422 |
}
|
423 |
}
|
@@ -426,17 +426,17 @@ jQuery(function($){
|
|
426 |
html += settings.ol_sub ? '<ol>' : '<ul>';
|
427 |
}else{
|
428 |
while(currLevel > level){
|
429 |
-
|
430 |
html += '</li>' + (settings.ol_sub ? '</ol>' : '</ul>');
|
431 |
}
|
432 |
html += '</li>';
|
433 |
}
|
434 |
}
|
435 |
-
html += '<li class="cmw-level-' + level + (data.included || '') + '"><a href="#' + anchor.data('indx') + '">' + anchor.text() + '</a>';
|
436 |
currLevel = level;
|
437 |
});
|
438 |
while(currLevel > 1){
|
439 |
-
|
440 |
html += '</li>' + (settings.ol_sub ? '</ol>' : '</ul>');
|
441 |
}
|
442 |
html += '</li>';
|
@@ -447,7 +447,7 @@ jQuery(function($){
|
|
447 |
return !!$(this).children('ul, ol').length;
|
448 |
}).addClass('cmw-has-submenu');
|
449 |
}
|
450 |
-
if(output.length && title &&
|
451 |
output.prepend((titleLinked ? '<h3 class="cmw-title-linked">' : '<h3>') + title + '</h3>');
|
452 |
}
|
453 |
}, //end showOutput()
|
@@ -479,7 +479,7 @@ jQuery(function($){
|
|
479 |
return selectedItem;
|
480 |
}, //end swapItems()
|
481 |
|
482 |
-
clickFieldset = function(
|
483 |
/**
|
484 |
* toggles a set of widgets options open or closed
|
485 |
* @this {element} Header of the set
|
@@ -492,13 +492,13 @@ jQuery(function($){
|
|
492 |
if(chkbox.length){
|
493 |
chkbox.prop('checked', collapse);
|
494 |
self.toggleClass('cmw-collapsed-fieldset', collapse);
|
495 |
-
chkbox.next('div')[collapse ? 'slideUp' : 'slideDown']();
|
496 |
}
|
497 |
this.blur();
|
498 |
return false;
|
499 |
}, //end clickFieldSet()
|
500 |
|
501 |
-
clickFindShortcodes = function(
|
502 |
/**
|
503 |
* fetches and displays a list of posts that contain old/new shortcodes
|
504 |
* @this {element} The link/button
|
@@ -524,7 +524,7 @@ jQuery(function($){
|
|
524 |
grandad.addClass('cmw-ajax-showing');
|
525 |
}
|
526 |
}
|
527 |
-
).always(function(response){
|
528 |
grandad.removeClass('cmw-ajax-fetching');
|
529 |
}
|
530 |
);
|
@@ -534,7 +534,7 @@ jQuery(function($){
|
|
534 |
return false;
|
535 |
},
|
536 |
|
537 |
-
clickFixedAbsolute = function(
|
538 |
/**
|
539 |
* toggles fixed/absolute positioning for the dialog (work around for draggable problems in jQuery UI v1.10.3/4)
|
540 |
* @this {element} The "fixed" button
|
@@ -554,7 +554,7 @@ jQuery(function($){
|
|
554 |
data.cmwMaxHeight = dialog.dialog('option', 'maxHeight');
|
555 |
}
|
556 |
//swap the icon...
|
557 |
-
self.
|
558 |
//toggle the class to force either fixed (add class) or absolute (remove class)...
|
559 |
dialogBox.toggleClass('cmw-assistance-dialog-fixed', !toAbsolute);
|
560 |
//have to reset dialog's maxHeight here, *before* re-positioning, because UI will screw up the position when we set it!...
|
@@ -564,7 +564,16 @@ jQuery(function($){
|
|
564 |
return false;
|
565 |
},
|
566 |
|
567 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
568 |
/**
|
569 |
* click handler for an item in the menu structure : sets or clears current menu item and its ancestors
|
570 |
* @this {element} Anchor element clicked on
|
@@ -578,12 +587,12 @@ jQuery(function($){
|
|
578 |
inPath = self.find('span').not('.' + cls[0]).parentsUntil(topOfMenu, 'li'),
|
579 |
i, n,
|
580 |
appendCls = function(){
|
581 |
-
this.title = this.title + ' ' + n.replace(' ', ' & ').replace(/-/g, ' ');
|
582 |
};
|
583 |
topOfMenu.find('.' + cls.join(',.')).removeClass(cls.join(' ')).each(function(){
|
584 |
-
this.title = this.title.replace(/\s.*$/, '');
|
585 |
});
|
586 |
-
for(i = 0; i < inPath.length; i
|
587 |
n = i === 1 ? cls.join(' ') : cls[0];
|
588 |
inPath.eq(i).children('.cmw-item').find('span').addClass(n).each(appendCls);
|
589 |
if(cls.length > 1){
|
@@ -592,10 +601,11 @@ jQuery(function($){
|
|
592 |
}
|
593 |
//run update() via assistance()...
|
594 |
assistance.call( $(dialog.data().cmwOnchange).get(0) );
|
|
|
595 |
return false;
|
596 |
}, //end clickMenu()
|
597 |
|
598 |
-
clickOutput = function(){
|
599 |
/**
|
600 |
* click handler for an item in the Basic Output list : triggers a click on the respective menu structure item
|
601 |
* @this {element} Anchor element clicked on
|
@@ -610,19 +620,20 @@ jQuery(function($){
|
|
610 |
return rtn;
|
611 |
}, //end clickOutput()
|
612 |
|
613 |
-
clickTreeExpander = function(
|
614 |
/**
|
615 |
* click handler for assist's menu tree expander/collapser
|
616 |
* @this {element} Element clicked on
|
617 |
* @param {object} e Event object
|
618 |
* @return {boolean} false
|
619 |
*/
|
620 |
-
var direction = /
|
621 |
-
$(this).toggleClass('
|
|
|
622 |
return false;
|
623 |
},
|
624 |
|
625 |
-
clickTickCross = function(
|
626 |
/**
|
627 |
* click handler for a tick or cross against any item in the menu structure (does not modify any classes)
|
628 |
* @this {element} Tick or Cross clicked on
|
@@ -654,7 +665,7 @@ jQuery(function($){
|
|
654 |
//find everything that currently has tickCross, and for (A) remove this item, or for (D) add this item...
|
655 |
//note : for (B) this item is already included, and for (C) this item is not already included and we don't want it to be
|
656 |
sampleSet = topOfMenu
|
657 |
-
.find('.cmw-has-' + tickOrCross)[ hasInheritTickCross || inheritsTickCrossFrom.length ? 'not' : 'add' ](item);
|
658 |
//(A) & (D) are now sorted and can be forgotten about
|
659 |
//for (B1), remove this item...
|
660 |
if(hasTickCross && (!item.children('ul').length || topOfMenu.parent().hasClass('cmw-version-210'))){
|
@@ -670,7 +681,7 @@ jQuery(function($){
|
|
670 |
sampleSet = sampleSet.add( inheritsTickCrossFrom.find('li').not(item) );
|
671 |
//map what's left to the associated item id, appending a plus sign for inheritance...
|
672 |
sampleSet = sampleSet.map(function(){
|
673 |
-
var plus = this === item[0] || this === inheritsTickCrossFrom.get(0) ? hasTickCross : $(this).hasClass('cmw-inherit-' + tickOrCross);
|
674 |
return $(this).data().itemid + (plus ? '+' : '');
|
675 |
})
|
676 |
.get().join( /(,|^-?\d+\+?$)/.test( $.trim(widgetField.val()) || ',' ) ? ',' : ' ' );
|
@@ -680,7 +691,7 @@ jQuery(function($){
|
|
680 |
return false;
|
681 |
}, //end clickTickCross()
|
682 |
|
683 |
-
closeDialog = function(
|
684 |
/**
|
685 |
* closes an open dialog when the widget is closed
|
686 |
* @this {element} The .widget-action or .widget-control-close clicked on
|
@@ -720,39 +731,45 @@ jQuery(function($){
|
|
720 |
//add a "fixed" button to the titlebar, enabling switching between fixed and absolute positioning for the dialog...
|
721 |
var dialogBox = $(this).closest('.ui-dialog');
|
722 |
if(dialogBox.hasClass('cmw-assistance-dialog-fixed')){
|
723 |
-
$('<
|
724 |
-
.
|
725 |
-
.
|
726 |
-
.
|
727 |
}
|
728 |
},
|
|
|
|
|
|
|
|
|
729 |
dialogClass: 'cmw-assistance-dialog cmw-assistance-dialog-fixed'
|
730 |
},
|
731 |
-
msgs = $.map(['
|
732 |
-
return '<div class="cmw-demo-' + v
|
733 |
}),
|
734 |
dialog = $('<div/>', {id:data.cmwDialogId}).addClass(widgetCustomMenuWizardClass('dialog'))
|
735 |
.append(
|
736 |
-
$('<div/>').addClass('cmw-demo-themenu cmw-version-' + data.
|
737 |
-
.html('<em class="cmw-demo-small">' +
|
738 |
)
|
739 |
.append(
|
740 |
-
$('<div/>').addClass('cmw-demo-theoutput')
|
741 |
-
.html('<em class="cmw-demo-small">' +
|
742 |
)
|
743 |
.append(
|
744 |
$('<div/>').addClass('cmw-demo-theshortcode')
|
745 |
-
.html('<code class="
|
746 |
);
|
747 |
dialog.dialog(dialogOpts);
|
748 |
-
dialog
|
749 |
-
.on('click', '.cmw-
|
750 |
-
.
|
|
|
|
|
751 |
dialog.find('.cmw-demo-theoutput').on('click', 'a', clickOutput);
|
752 |
return dialog;
|
753 |
}, //end createDialog()
|
754 |
|
755 |
-
removeDialog = function(
|
756 |
/**
|
757 |
* removes associated dialog when the widget is deleted
|
758 |
* @this {element} The .widget-control-remove clicked on
|
@@ -793,12 +810,14 @@ jQuery(function($){
|
|
793 |
//x is the level of the *previous* item; so if previous item was at level 4, then its parent was at level 3, and
|
794 |
//was therefore indented twice (given that a level 1 item is not indented), so number of outdents is x - 2!
|
795 |
//each level is indented by 2.4em; subtract 2 from x and multiply by 2.4em, then add another 2em...
|
796 |
-
return x > 1 ? '<a href="#" class="' + widgetCustomMenuWizardClass('colexp') + '
|
797 |
};
|
798 |
if(!currentmenu.length || currentmenu.data('menuid') !== menuid){
|
799 |
oc.find('.cmw-assist-items optgroup').find('option').each(function(i){
|
800 |
var self = $(this),
|
801 |
-
|
|
|
|
|
802 |
while(level < trace.length){
|
803 |
menu += '</li></ul>' + outdentedExpander(trace.length);
|
804 |
trace.pop();
|
@@ -812,9 +831,11 @@ jQuery(function($){
|
|
812 |
//data-level is 1-based, with 1 being root
|
813 |
//data-trace is the menu item ids of this item's ancestors, from root down to parent (inclusive)
|
814 |
menu += '<li class="level-' + level + '" data-itemid="' + this.value + '" data-level="' + level + '" data-trace="' + trace.join(',') + '">';
|
815 |
-
menu += '<a href="#" class="cmw-cross
|
816 |
-
menu += '<a class="cmw-item
|
817 |
-
menu += '
|
|
|
|
|
818 |
trace.push(this.value);
|
819 |
if(level > maxLevel){
|
820 |
maxLevel = level;
|
@@ -827,10 +848,12 @@ jQuery(function($){
|
|
827 |
currentmenu.remove();
|
828 |
dialog.find('.cmw-demo-themenu')
|
829 |
.append( $(menu).addClass('cmw-demo-themenu-ul').data({maxLevel:maxLevel, menuid:menuid}) );
|
|
|
|
|
830 |
}
|
831 |
}, //end createMenu()
|
832 |
|
833 |
-
clickAssist = function(
|
834 |
/**
|
835 |
* toggles the assist dialog open/closed, creating it if necessary
|
836 |
* @this {element} A The assist anchor
|
@@ -844,7 +867,7 @@ jQuery(function($){
|
|
844 |
if(!dialog.length){
|
845 |
dialog = createDialog(data).data({
|
846 |
cmwOnchange: '#' + oc.attr('id'),
|
847 |
-
cmwUntitled: '[' +
|
848 |
});
|
849 |
}
|
850 |
if(dialog.dialog('isOpen')){
|
@@ -864,8 +887,8 @@ jQuery(function($){
|
|
864 |
* There is a default set of functions, and any different legacy versions that are still
|
865 |
* supported should be under their own 'vNNN' object (eg. 'v210'). Which set of functions
|
866 |
* is called is determined by assistance(), which is the only entry point (into update()),
|
867 |
-
* and is governed by the widget form (specifically, the
|
868 |
-
* attached to the -onchange wrapper).
|
869 |
*/
|
870 |
cmwAssist = {
|
871 |
setLevels : function(oc, maxLevel){
|
@@ -882,13 +905,12 @@ jQuery(function($){
|
|
882 |
theSelect.find('optgroup').each(function(i){
|
883 |
var self = $(this),
|
884 |
opts = self.find('option'),
|
885 |
-
ct = opts.length
|
886 |
-
texts = self.data();
|
887 |
if(i){
|
888 |
//absolute...
|
889 |
opts.slice(maxLevel).remove();
|
890 |
while(ct < maxLevel){
|
891 |
-
|
892 |
self.append( $('<option/>', {value:ct}).text(ct) );
|
893 |
}
|
894 |
}else{
|
@@ -899,16 +921,16 @@ jQuery(function($){
|
|
899 |
//etc, etc
|
900 |
ct = (ct + 1) / 2;
|
901 |
if(ct > maxLevel){
|
902 |
-
opts.each(function(
|
903 |
if(Math.abs(el.value) >= maxLevel){
|
904 |
$(el).remove();
|
905 |
}
|
906 |
});
|
907 |
}
|
908 |
while(ct < maxLevel){
|
909 |
-
self.prepend( $('<option/>', {value:-ct}).text(-ct + (ct > 1 ? '' : ' (' +
|
910 |
-
.append( $('<option/>', {value:'+' + ct}).text('+' + ct + (ct > 1 ? '' : ' (' +
|
911 |
-
|
912 |
}
|
913 |
}
|
914 |
});
|
@@ -924,6 +946,8 @@ jQuery(function($){
|
|
924 |
|
925 |
oc.find('.cmw-set-rel-abs-levels').each(function(){
|
926 |
var self = $(this),
|
|
|
|
|
927 |
optgroups = self.find('optgroup'),
|
928 |
ct = (optgroups.find('option').length / 2) + 1, //should never be below 2
|
929 |
v = self.val(),
|
@@ -934,12 +958,12 @@ jQuery(function($){
|
|
934 |
if(ct !== minLevel){
|
935 |
optgroups.each(function(i, el){
|
936 |
var optgroup = $(el),
|
937 |
-
text =
|
938 |
j;
|
939 |
if(ct > minLevel){
|
940 |
optgroup.find('option').slice( minLevel - ct ).remove();
|
941 |
}
|
942 |
-
for(j = ct; j < minLevel; j
|
943 |
optgroup.append( $('<option/>', {value:i ? j : -j}).text( text.replace('%d', i ? j : -j) ) );
|
944 |
}
|
945 |
});
|
@@ -955,7 +979,7 @@ jQuery(function($){
|
|
955 |
below = options.eq(3).text();
|
956 |
options.slice( (maxLevel * 3) + 1 ).remove();
|
957 |
while(ct < maxLevel){
|
958 |
-
|
959 |
self.append( $('<option/>', {value:ct}).text(ct) )
|
960 |
.append( $('<option/>', {value:ct + '-'}).text(above.replace(/\d+/, ct)) )
|
961 |
.append( $('<option/>', {value:ct + '+'}).text(below.replace(/\d+/, ct)) );
|
@@ -968,9 +992,8 @@ jQuery(function($){
|
|
968 |
//do the easy levels...
|
969 |
oc.find('.cmw-set-levels').each(function(){
|
970 |
var self = $(this),
|
971 |
-
|
972 |
-
|
973 |
-
leave = data.cmwSetLevels || 0,
|
974 |
opts = self.find('option'),
|
975 |
ct = opts.length - leave;
|
976 |
//if current value exceeds maxLevel, reset to first option...
|
@@ -981,8 +1004,8 @@ jQuery(function($){
|
|
981 |
self.find('option').slice(leave + maxLevel).remove();
|
982 |
//append enough new options to bring up to maxLevel...
|
983 |
while(ct < maxLevel){
|
984 |
-
|
985 |
-
self.append( $('<option/>', {value:ct}).text(
|
986 |
}
|
987 |
});
|
988 |
}, //end cmwAssist.setLevels()
|
@@ -998,11 +1021,12 @@ jQuery(function($){
|
|
998 |
notByBranch = byItems || !byBranchCheckbox.prop('checked'),
|
999 |
menuItems = oc.find('.cmw-assist-items'),
|
1000 |
selectedItem = parseInt(menuItems.val(), 10),
|
1001 |
-
fallback;
|
1002 |
//change of menu? : make sure the correct optgroup of menu items is used...
|
1003 |
if(target.hasClass('cmw-select-menu')){
|
1004 |
selectedItem = swapItems(menuItems, selectedItem, target[0].selectedIndex);
|
1005 |
-
|
|
|
1006 |
//if level is changed, switch to by-level filtering...
|
1007 |
}else if(target.hasClass('cmw-level')){
|
1008 |
notByBranch = true;
|
@@ -1010,7 +1034,8 @@ jQuery(function($){
|
|
1010 |
oc.find('.cmw-bylevel').prop('checked', notByBranch);
|
1011 |
//if by-branch's branch is changed, switch to by-branch filtering...
|
1012 |
}else if(target.is(menuItems)){
|
1013 |
-
notByBranch =
|
|
|
1014 |
byBranchCheckbox.prop('checked', !notByBranch);
|
1015 |
//change of items?, switch to by-items filtering...
|
1016 |
}else if(target.hasClass('cmw-setitems')){
|
@@ -1053,7 +1078,7 @@ jQuery(function($){
|
|
1053 |
byBranch = settings.filter === 'branch',
|
1054 |
byItems = settings.filter === 'items',
|
1055 |
byLevel = !byBranch && !byItems,
|
1056 |
-
|
1057 |
//take notice of the widget's hide_title flag...
|
1058 |
if(settings.title && !settings.hide_title){
|
1059 |
args.title = [settings.title];
|
@@ -1080,7 +1105,8 @@ jQuery(function($){
|
|
1080 |
}
|
1081 |
//specifying items set byItems, overriding byLevel & byBranch...
|
1082 |
if(byItems){
|
1083 |
-
|
|
|
1084 |
}
|
1085 |
//depth is not relevant to byItems...
|
1086 |
else{
|
@@ -1121,8 +1147,9 @@ jQuery(function($){
|
|
1121 |
args.include_level = [settings.include_level];
|
1122 |
}
|
1123 |
//exclusions by id...
|
1124 |
-
|
1125 |
-
|
|
|
1126 |
}
|
1127 |
//...and by level...
|
1128 |
if(settings.exclude_level){
|
@@ -1144,40 +1171,65 @@ jQuery(function($){
|
|
1144 |
}
|
1145 |
}
|
1146 |
//switches...
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1150 |
}
|
1151 |
-
|
1152 |
//strings...
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1157 |
}
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1164 |
}
|
1165 |
-
|
1166 |
//alternative...
|
1167 |
if(settings.switch_if){
|
1168 |
if(settings.switch_at){
|
1169 |
args.alternative = [settings.switch_if, settings.switch_at];
|
1170 |
-
|
1171 |
}
|
1172 |
}
|
1173 |
//build the shortcode...
|
1174 |
-
|
1175 |
-
|
1176 |
//array indicates join (with comma sep) & surround it in double quotes, otherwise leave 'as-is'...
|
1177 |
-
|
1178 |
-
}
|
1179 |
//NB at v3.0.0, the shortcode changed from custom_menu_wizard to cmwizard (the previous version is still supported)
|
1180 |
-
return '[cmwizard ' +
|
1181 |
}, //end cmwAssist.shortcode()
|
1182 |
|
1183 |
structureUpdate : function(dialog, settings, usingAlts){
|
@@ -1247,7 +1299,8 @@ jQuery(function($){
|
|
1247 |
|
1248 |
//primary filter : level...
|
1249 |
if(byLevel && items.length && settings.level > 1){
|
1250 |
-
|
|
|
1251 |
j.push('.level-' + i);
|
1252 |
}
|
1253 |
items = items.not( j.join(',') );
|
@@ -1269,7 +1322,7 @@ jQuery(function($){
|
|
1269 |
stage = 'secondary';
|
1270 |
//secondary filter : level...
|
1271 |
if(byLevel && items.length && local_depth){
|
1272 |
-
i = local_depth_rel_current && currentItemLevel >= settings.level
|
1273 |
//if the limited depth is relative to current item, and current item can be found at or below the start level...
|
1274 |
? currentItemLevel
|
1275 |
//set relative to start level...
|
@@ -1277,7 +1330,7 @@ jQuery(function($){
|
|
1277 |
i += local_depth;
|
1278 |
//note that i has been set to the first level *not* wanted!
|
1279 |
if(i <= maxLevel){
|
1280 |
-
for(j = []; i <= maxLevel; i
|
1281 |
j.push('.level-' + i);
|
1282 |
}
|
1283 |
//filter to remove...
|
@@ -1290,7 +1343,7 @@ jQuery(function($){
|
|
1290 |
//convert start level to integer...
|
1291 |
j = parseInt(settings.branch_start, 10);
|
1292 |
//convert relative to absolute (max'd against 1)...
|
1293 |
-
j = isNaN(j) || !j ? tobLevel : (settings.branch_start.match(/^(\+|-)/) ? Math.max(1, tobLevel + j) : j);
|
1294 |
|
1295 |
//in order to be eligible for a no-kids fallback:
|
1296 |
// - branch must be current item
|
@@ -1304,7 +1357,7 @@ jQuery(function($){
|
|
1304 |
j = maxLevel + 1;
|
1305 |
}else{
|
1306 |
//for current, fall back to tob; for parent, fall back to tob - 1, ensuring that we don't fall back further than root...
|
1307 |
-
j = settings.fallback === 'current' || tobLevel < 2 ? tobLevel : tobLevel - 1;
|
1308 |
//if fallback depth is specified, override depth and set to relative-to-current...
|
1309 |
if(settings.fallback_depth){
|
1310 |
local_depth = settings.fallback_depth;
|
@@ -1346,14 +1399,15 @@ jQuery(function($){
|
|
1346 |
k = 9999;
|
1347 |
if(local_depth){
|
1348 |
//is (limited) depth relative to current item, and is there an eligible current item to measure against?...
|
1349 |
-
k = local_depth_rel_current && currentItemLevel >= tobLevel && items.filter(currentItemLI).length
|
1350 |
? currentItemLevel
|
1351 |
: tobLevel;
|
1352 |
k += local_depth;
|
1353 |
lastVisibleLevel = k - 1;
|
1354 |
}
|
1355 |
//note that k has been set to the first level (after those wanted) that is *not* wanted!
|
1356 |
-
|
|
|
1357 |
if(i >= tobLevel && i < k){
|
1358 |
j.push('.level-' + i);
|
1359 |
}
|
@@ -1396,7 +1450,9 @@ jQuery(function($){
|
|
1396 |
y = Math.max(1, j + y);
|
1397 |
}
|
1398 |
//get the level classes for ancestors and siblings that need to be included...
|
1399 |
-
|
|
|
|
|
1400 |
if(i <= lastVisibleLevel){
|
1401 |
//ancestors...
|
1402 |
j.push('.level-' + i);
|
@@ -1512,11 +1568,16 @@ jQuery(function($){
|
|
1512 |
// are being used, and prevents them being clicked on - because they can't be updated back into the current settings)...
|
1513 |
dialog.find('.cmw-demo-themenu-ul').toggleClass('cmw-using-alternative', !!usingAlts);
|
1514 |
//show/hide the inclusions/exclusions messages...
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
|
|
|
|
|
|
|
|
|
|
1520 |
|
1521 |
//toggle ticks and 'pick' the remaining items...
|
1522 |
topOfMenu.toggleClass('cmw-demo-filteritems', byItems)
|
@@ -1587,27 +1648,25 @@ jQuery(function($){
|
|
1587 |
*/
|
1588 |
var theSelect = oc.find('.cmw-start-level'),
|
1589 |
level = theSelect.val(),
|
1590 |
-
ct = theSelect.find('option').length
|
1591 |
-
txt;
|
1592 |
if(level > maxLevel){
|
1593 |
theSelect.val(1);
|
1594 |
}
|
1595 |
theSelect.find('option').slice(maxLevel).remove();
|
1596 |
while(ct < maxLevel){
|
1597 |
-
|
1598 |
theSelect.append( $('<option/>', {value:ct}).text(ct) );
|
1599 |
}
|
1600 |
theSelect = oc.find('.cmw-depth');
|
1601 |
level = theSelect.val();
|
1602 |
ct = theSelect.find('option').length;
|
1603 |
-
txt = theSelect.data().cmwTextLevels;
|
1604 |
if(level > maxLevel){
|
1605 |
theSelect.val(0); //=unlimited
|
1606 |
}
|
1607 |
theSelect.find('option').slice(maxLevel + 1).remove();
|
1608 |
while(ct <= maxLevel){
|
1609 |
-
theSelect.append( $('<option/>', {value:ct}).text(ct
|
1610 |
-
|
1611 |
}
|
1612 |
}, //end cmwAssist.v210.setLevels()
|
1613 |
|
@@ -1620,11 +1679,13 @@ jQuery(function($){
|
|
1620 |
var showAll = oc.find('.cmw-showall').prop('checked'),
|
1621 |
showSpecific = oc.find('.cmw-showspecific').prop('checked'),
|
1622 |
menuItems = oc.find('.cmw-assist-items'),
|
1623 |
-
selectedItem = parseInt(menuItems.val(), 10)
|
|
|
1624 |
//change of menu? : make sure the correct optgroup of menu items is used...
|
1625 |
if(target.hasClass('cmw-select-menu')){
|
1626 |
selectedItem = swapItems(menuItems, selectedItem, target[0].selectedIndex);
|
1627 |
-
|
|
|
1628 |
}
|
1629 |
$.each(
|
1630 |
{ '' : showAll || showSpecific,
|
@@ -1649,7 +1710,7 @@ jQuery(function($){
|
|
1649 |
byLevel = !settings.filter,
|
1650 |
byBranch = settings.filter > 0,
|
1651 |
byItems = !byLevel && !byBranch,
|
1652 |
-
|
1653 |
if(settings.title){
|
1654 |
args.title = [settings.title];
|
1655 |
}
|
@@ -1663,7 +1724,8 @@ jQuery(function($){
|
|
1663 |
}
|
1664 |
}
|
1665 |
if(byItems){
|
1666 |
-
|
|
|
1667 |
}
|
1668 |
if(byBranch && settings.filter_item < 0 && settings.fallback_no_ancestor){
|
1669 |
if(settings.fallback_include_parent_siblings){
|
@@ -1717,30 +1779,51 @@ jQuery(function($){
|
|
1717 |
if(n.length){
|
1718 |
args.title_from = n;
|
1719 |
}
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1723 |
}
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1729 |
}
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
|
|
|
|
|
|
|
|
|
|
1736 |
}
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
//array indicates join (with space sep) & surround it in double quotes, otherwise leave 'as-is'...
|
1741 |
-
|
1742 |
-
}
|
1743 |
-
return '[custom_menu_wizard ' +
|
1744 |
}, //end cmwAssist.v210.shortcode()
|
1745 |
|
1746 |
update : function(el){
|
@@ -1834,7 +1917,7 @@ jQuery(function($){
|
|
1834 |
}else{
|
1835 |
j = settings.depth ? settings.start_level + settings.depth - 1 : 9999;
|
1836 |
}
|
1837 |
-
for(i = 1; i <= maxLevel; i
|
1838 |
if(i < settings.start_level || i > j){
|
1839 |
items = items.not('.level-' + i);
|
1840 |
}
|
4 |
* to avoid Google Close Compiler producing a "Misplaced function annotation" warning!
|
5 |
*/
|
6 |
/*global jQuery, window, document, ajaxurl */
|
7 |
+
/*jslint browser: true, for: true, multivar: true, this: true, white: true */
|
8 |
+
/*jshint curly: true, eqeqeq: true, forin: true, freeze: true, futurehostile: true, latedef: true, noarg: true, nocomma: true, nonbsp: true, nonew: true, strict: true, undef: true, laxbreak: true */
|
9 |
jQuery(function($){
|
10 |
'use strict';
|
11 |
var cmwAssist,
|
12 |
//only test for : key="value", key='value' and key=value...
|
13 |
parseSwitchTo = /(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)/g,
|
14 |
|
15 |
+
getText = function(t){
|
16 |
+
return !window.Custom_Menu_Wizard_Texts ? t : window.Custom_Menu_Wizard_Texts[t] || t;
|
17 |
+
},
|
18 |
+
|
19 |
isNumeric = function(x){
|
20 |
return (/^[+\-]?\d+$/).test(x.toString());
|
21 |
},
|
30 |
* @this {element} div.widget-custom-menu-wizard-onchange
|
31 |
* @param {object} e Event object
|
32 |
*/
|
33 |
+
var v = $(this).data().cmwInstanceVersion.replace(/\./g, '');
|
34 |
v = /^\d+$/.test(v) ? 'v' + v : v;
|
35 |
//run the update() method of the relevant assist object, based on a version number...
|
36 |
if(cmwAssist[v]){
|
48 |
* @return {object} key=>value pairs of the field element values
|
49 |
*/
|
50 |
var useAlternative = oc === false,
|
|
|
51 |
settings = {},
|
52 |
+
legacyVersion = !useAlternative && oc.data().cmwInstanceVersion === '2.1.0',
|
53 |
csv = {items:1, exclude:1},
|
54 |
keepAsString = $.extend({branch_start:1, exclude_level:1, include_level:1}, csv);
|
55 |
+
$.each(useAlternative ? altFields : oc.find(':input').serializeArray(), function(ignore, v){
|
56 |
var name = v.name.replace(/.*\[([^\]]+)\]$/, '$1'),
|
57 |
+
val = ( !keepAsString[name] && (/^-?\d+$/).test(v.value) ) ? parseInt(v.value, 10) : v.value;
|
58 |
settings[name] = val;
|
59 |
+
if(csv[name]){
|
60 |
+
settings['_' + name + '_sep'] = ( !val || (/(^-?\d+\+?$|,)/).test($.trim(val)) ) ? ',' : ' ';
|
|
|
|
|
61 |
val = $.map(val.split(/[,\s]+/), function(x){
|
62 |
+
var inherit = !legacyVersion && (/\+$/).test(x);
|
63 |
x = x ? parseInt(x, 10) : 0;
|
64 |
+
return ( isNaN(x) || !x ) ? null : (inherit ? x + '+' : x);
|
65 |
});
|
66 |
settings['_' + name] = val.join(settings['_' + name + '_sep']);
|
67 |
}
|
124 |
i = 0,
|
125 |
byItems, byBranch, byLevel, n;
|
126 |
while(attribute){
|
127 |
+
i += 1;
|
128 |
// key = "value" [1] [2] ...
|
129 |
if(attribute[1]){
|
130 |
attr[ attribute[1] ] = attribute[2];
|
135 |
}else if(attribute[5]){
|
136 |
attr[ attribute[5] ] = attribute[6];
|
137 |
}else{
|
138 |
+
i -= 1;
|
139 |
}
|
140 |
attribute = parseSwitchTo.exec(switchTo);
|
141 |
}
|
142 |
if(i){
|
143 |
+
$.each(attr, function(k, v){
|
144 |
+
alts[k] = v;
|
145 |
+
});
|
|
|
|
|
146 |
}
|
147 |
|
148 |
//in order of priority...
|
221 |
if( n.indexOf(' +siblings ') >= 0){
|
222 |
alts.fallback_siblings = 1;
|
223 |
}
|
224 |
+
for(i = 0; i < attr.length; i += 1){
|
225 |
if(/^\d+$/.test(attr[i])){
|
226 |
n = parseInt(attr[i], 10);
|
227 |
if(n > 0){
|
235 |
//title_from => title_...
|
236 |
if(alts.title_from){
|
237 |
attr = alts.title_from.toLowerCase().split(/[\s,]+/);
|
238 |
+
for(i = 0; i < attr.length; i += 1){
|
239 |
if(attr[i]){
|
240 |
if(attr[i] === 'branch' || attr[i] === 'current'){
|
241 |
alts['title_' + attr[i]] = '0';
|
258 |
}
|
259 |
}
|
260 |
alts.title_from = null;
|
|
|
261 |
|
262 |
return getSettings( false, $.map(alts, function(v, k){ return v === null ? v : {name:k, value:v}; }) );
|
263 |
}, //end alternativeParse()
|
274 |
rtn = x.replace(/[\r\n\t]+/g, ' ').replace(/^[\[\s]+/, '').replace(/[\s\/\]]+$/, '').split(/[\[\]]/)[0];
|
275 |
//trim trailing slash, surrounding spaces, and append a space...
|
276 |
rtn = $.trim(rtn.replace(/\/+$/, '')) + ' ';
|
277 |
+
//remove leading cmwizard, any occurrence of menu|widget=something, and any occurrence of alternative="something" (optional quotes)...
|
278 |
+
rtn = ' ' + rtn.replace(/^cmwizard\s/, '') + ' ';
|
279 |
+
rtn = $.trim( rtn.replace(/\s(menu|widget)=[^\s]*/g, ' ').replace(/\salternative=("[^"]*"|[^\s]*)/g, ' ') );
|
280 |
//remove multiple spaces...
|
281 |
rtn = rtn.replace(/\s\s+/g, ' ');
|
282 |
}
|
316 |
* @param {string} tickOrCross Either 'tick' or 'cross'
|
317 |
* @return {object} jQuery of filtered items
|
318 |
*/
|
319 |
+
var sep = tickOrCross === 'tick' ? '_items_sep' : '_exclude_sep',
|
320 |
inheritance = [],
|
321 |
haystack = tickOrCross === 'tick' ? '_items' : '_exclude';
|
322 |
+
sep = settings[sep];
|
323 |
haystack = settings[haystack]
|
324 |
+
//extract those with inheritance...
|
325 |
+
? $.grep(settings[haystack].split(sep), function(v){
|
326 |
if(/\+$/.test(v)){
|
327 |
inheritance.push(parseInt(v, 10));
|
328 |
return !v;
|
373 |
i;
|
374 |
k = k ? [parseInt(k[1], 10), k[2] || ''] : [];
|
375 |
if(k[0] > 0){
|
376 |
+
for(i = 1; i <= maxLevel; i += 1){
|
377 |
if( i === k[0] || (k[1] === '-' && i < k[0]) || (k[1] === '+' && i > k[0]) ){
|
378 |
rtn.push('.level-' + i);
|
379 |
}
|
399 |
itemList = {};
|
400 |
if(items.length && output.length){
|
401 |
//determine title: update() might have set a class for it...
|
402 |
+
title = topOfMenu.find('.title-from-item').children('.cmw-item').find('strong').text() || '';
|
403 |
titleLinked = !!title && !!settings.title_linked;
|
404 |
//...otherwise, check the actual widget title...
|
405 |
if(!title && !settings.hide_title){
|
415 |
anchor = self.children('.cmw-item');
|
416 |
if(!settings.flat_output){
|
417 |
itemList[iid] = 1;
|
418 |
+
for(i = 0; i < trace.length; i += 1){
|
419 |
if(itemList[trace[i]]){
|
420 |
+
level += 1;
|
421 |
}
|
422 |
}
|
423 |
}
|
426 |
html += settings.ol_sub ? '<ol>' : '<ul>';
|
427 |
}else{
|
428 |
while(currLevel > level){
|
429 |
+
currLevel -= 1;
|
430 |
html += '</li>' + (settings.ol_sub ? '</ol>' : '</ul>');
|
431 |
}
|
432 |
html += '</li>';
|
433 |
}
|
434 |
}
|
435 |
+
html += '<li class="cmw-level-' + level + (data.included || '') + '"><a href="#' + anchor.data('indx') + '">' + anchor.find('strong').text() + '</a>';
|
436 |
currLevel = level;
|
437 |
});
|
438 |
while(currLevel > 1){
|
439 |
+
currLevel -= 1;
|
440 |
html += '</li>' + (settings.ol_sub ? '</ol>' : '</ul>');
|
441 |
}
|
442 |
html += '</li>';
|
447 |
return !!$(this).children('ul, ol').length;
|
448 |
}).addClass('cmw-has-submenu');
|
449 |
}
|
450 |
+
if(output.length && title && items.length){
|
451 |
output.prepend((titleLinked ? '<h3 class="cmw-title-linked">' : '<h3>') + title + '</h3>');
|
452 |
}
|
453 |
}, //end showOutput()
|
479 |
return selectedItem;
|
480 |
}, //end swapItems()
|
481 |
|
482 |
+
clickFieldset = function(ignore){
|
483 |
/**
|
484 |
* toggles a set of widgets options open or closed
|
485 |
* @this {element} Header of the set
|
492 |
if(chkbox.length){
|
493 |
chkbox.prop('checked', collapse);
|
494 |
self.toggleClass('cmw-collapsed-fieldset', collapse);
|
495 |
+
chkbox.next('div')[collapse ? 'slideUp' : 'slideDown']('fast');
|
496 |
}
|
497 |
this.blur();
|
498 |
return false;
|
499 |
}, //end clickFieldSet()
|
500 |
|
501 |
+
clickFindShortcodes = function(ignore){
|
502 |
/**
|
503 |
* fetches and displays a list of posts that contain old/new shortcodes
|
504 |
* @this {element} The link/button
|
524 |
grandad.addClass('cmw-ajax-showing');
|
525 |
}
|
526 |
}
|
527 |
+
).always(function(/*response*/){
|
528 |
grandad.removeClass('cmw-ajax-fetching');
|
529 |
}
|
530 |
);
|
534 |
return false;
|
535 |
},
|
536 |
|
537 |
+
clickFixedAbsolute = function(ignore){
|
538 |
/**
|
539 |
* toggles fixed/absolute positioning for the dialog (work around for draggable problems in jQuery UI v1.10.3/4)
|
540 |
* @this {element} The "fixed" button
|
554 |
data.cmwMaxHeight = dialog.dialog('option', 'maxHeight');
|
555 |
}
|
556 |
//swap the icon...
|
557 |
+
self.children('span').toggleClass('dashicons-no-alt', toAbsolute);
|
558 |
//toggle the class to force either fixed (add class) or absolute (remove class)...
|
559 |
dialogBox.toggleClass('cmw-assistance-dialog-fixed', !toAbsolute);
|
560 |
//have to reset dialog's maxHeight here, *before* re-positioning, because UI will screw up the position when we set it!...
|
564 |
return false;
|
565 |
},
|
566 |
|
567 |
+
clickItemExtras = function(ignore){
|
568 |
+
/**
|
569 |
+
* click handler for toggling more/less item display
|
570 |
+
*/
|
571 |
+
$(this).closest('.widget-custom-menu-wizard-dialog').toggleClass('cmw-show-item-extras');
|
572 |
+
this.blur();
|
573 |
+
return false;
|
574 |
+
},
|
575 |
+
|
576 |
+
clickMenu = function(ignore){
|
577 |
/**
|
578 |
* click handler for an item in the menu structure : sets or clears current menu item and its ancestors
|
579 |
* @this {element} Anchor element clicked on
|
587 |
inPath = self.find('span').not('.' + cls[0]).parentsUntil(topOfMenu, 'li'),
|
588 |
i, n,
|
589 |
appendCls = function(){
|
590 |
+
this.title = this.title + ' : ' + n.replace(' ', ' & ').replace(/-/g, ' ');
|
591 |
};
|
592 |
topOfMenu.find('.' + cls.join(',.')).removeClass(cls.join(' ')).each(function(){
|
593 |
+
this.title = this.title.replace(/\s:\s.*$/, '');
|
594 |
});
|
595 |
+
for(i = 0; i < inPath.length; i += 1){
|
596 |
n = i === 1 ? cls.join(' ') : cls[0];
|
597 |
inPath.eq(i).children('.cmw-item').find('span').addClass(n).each(appendCls);
|
598 |
if(cls.length > 1){
|
601 |
}
|
602 |
//run update() via assistance()...
|
603 |
assistance.call( $(dialog.data().cmwOnchange).get(0) );
|
604 |
+
this.blur();
|
605 |
return false;
|
606 |
}, //end clickMenu()
|
607 |
|
608 |
+
clickOutput = function(ignore){
|
609 |
/**
|
610 |
* click handler for an item in the Basic Output list : triggers a click on the respective menu structure item
|
611 |
* @this {element} Anchor element clicked on
|
620 |
return rtn;
|
621 |
}, //end clickOutput()
|
622 |
|
623 |
+
clickTreeExpander = function(ignore){
|
624 |
/**
|
625 |
* click handler for assist's menu tree expander/collapser
|
626 |
* @this {element} Element clicked on
|
627 |
* @param {object} e Event object
|
628 |
* @return {boolean} false
|
629 |
*/
|
630 |
+
var direction = /w-r/.test(this.className) ? 'slideUp' : 'slideDown';
|
631 |
+
$(this).toggleClass('dashicons-arrow-right dashicons-arrow-down').prev('ul')[direction]('fast');
|
632 |
+
this.blur();
|
633 |
return false;
|
634 |
},
|
635 |
|
636 |
+
clickTickCross = function(ignore){
|
637 |
/**
|
638 |
* click handler for a tick or cross against any item in the menu structure (does not modify any classes)
|
639 |
* @this {element} Tick or Cross clicked on
|
665 |
//find everything that currently has tickCross, and for (A) remove this item, or for (D) add this item...
|
666 |
//note : for (B) this item is already included, and for (C) this item is not already included and we don't want it to be
|
667 |
sampleSet = topOfMenu
|
668 |
+
.find('.cmw-has-' + tickOrCross)[ ( hasInheritTickCross || inheritsTickCrossFrom.length ) ? 'not' : 'add' ](item);
|
669 |
//(A) & (D) are now sorted and can be forgotten about
|
670 |
//for (B1), remove this item...
|
671 |
if(hasTickCross && (!item.children('ul').length || topOfMenu.parent().hasClass('cmw-version-210'))){
|
681 |
sampleSet = sampleSet.add( inheritsTickCrossFrom.find('li').not(item) );
|
682 |
//map what's left to the associated item id, appending a plus sign for inheritance...
|
683 |
sampleSet = sampleSet.map(function(){
|
684 |
+
var plus = ( this === item[0] || this === inheritsTickCrossFrom.get(0) ) ? hasTickCross : $(this).hasClass('cmw-inherit-' + tickOrCross);
|
685 |
return $(this).data().itemid + (plus ? '+' : '');
|
686 |
})
|
687 |
.get().join( /(,|^-?\d+\+?$)/.test( $.trim(widgetField.val()) || ',' ) ? ',' : ' ' );
|
691 |
return false;
|
692 |
}, //end clickTickCross()
|
693 |
|
694 |
+
closeDialog = function(ignore){
|
695 |
/**
|
696 |
* closes an open dialog when the widget is closed
|
697 |
* @this {element} The .widget-action or .widget-control-close clicked on
|
731 |
//add a "fixed" button to the titlebar, enabling switching between fixed and absolute positioning for the dialog...
|
732 |
var dialogBox = $(this).closest('.ui-dialog');
|
733 |
if(dialogBox.hasClass('cmw-assistance-dialog-fixed')){
|
734 |
+
$('<a/>').addClass('cmw-dialog-fixed-absolute button-secondary')
|
735 |
+
.append( $('<span/>').addClass('dashicons-before dashicons-yes').text(getText('fixed')) )
|
736 |
+
.on('click', clickFixedAbsolute)
|
737 |
+
.appendTo( dialogBox.find('.ui-dialog-titlebar') );
|
738 |
}
|
739 |
},
|
740 |
+
dragStop: function(){
|
741 |
+
//set height to auto...
|
742 |
+
$(this).dialog('option', 'height', 'auto');
|
743 |
+
},
|
744 |
dialogClass: 'cmw-assistance-dialog cmw-assistance-dialog-fixed'
|
745 |
},
|
746 |
+
msgs = $.map(['setcurrent', 'inclusions', 'exclusions', 'fallback', 'alternative'], function(v){
|
747 |
+
return '<div class="cmw-demo-' + v + ' cmw-demo-small">' + getText(v) + '</div>';
|
748 |
}),
|
749 |
dialog = $('<div/>', {id:data.cmwDialogId}).addClass(widgetCustomMenuWizardClass('dialog'))
|
750 |
.append(
|
751 |
+
$('<div/>').addClass('cmw-demo-themenu cmw-version-' + data.cmwInstanceVersion.replace(/\./g, ''))
|
752 |
+
.html('<em class="cmw-demo-small">' + getText('prompt') + '</em>')
|
753 |
)
|
754 |
.append(
|
755 |
+
$('<div/>').addClass('cmw-demo-theoutput cmw-corners')
|
756 |
+
.html('<em class="cmw-demo-small">' + getText('output') + '</em><em class="cmw-demo-plugin-version cmw-demo-small">v' + data.cmwInstanceVersion + '</em>' + msgs.shift() + '<div class="cmw-demo-theoutput-wrap cmw-corners"></div>' + msgs.join(''))
|
757 |
)
|
758 |
.append(
|
759 |
$('<div/>').addClass('cmw-demo-theshortcode')
|
760 |
+
.html('<code class="cmw-corners"></code><a class="button-secondary cmw-toggle-item-extras"><span>' + getText('more') + '</span><span>' + getText('less') + '</span></a><div class="cmw-find-shortcodes"><a href="#" class="button-secondary ' + widgetCustomMenuWizardClass('find-shortcodes') + '" data-nonce="' + (data.cmwDialogNonce || '') + '" title="' + getText('shortcodes') + '"><span class="spinner"></span><span>[…]</span></a></div><div class="cmw-demo-found-shortcodes cmw-demo-small cmw-corners"></div>')
|
761 |
);
|
762 |
dialog.dialog(dialogOpts);
|
763 |
+
dialog
|
764 |
+
.on('click', '.cmw-toggle-item-extras', clickItemExtras)
|
765 |
+
.find('.cmw-demo-themenu')
|
766 |
+
.on('click', '.cmw-tick,.cmw-cross', clickTickCross)
|
767 |
+
.on('click', '.cmw-item', clickMenu);
|
768 |
dialog.find('.cmw-demo-theoutput').on('click', 'a', clickOutput);
|
769 |
return dialog;
|
770 |
}, //end createDialog()
|
771 |
|
772 |
+
removeDialog = function(ignore){
|
773 |
/**
|
774 |
* removes associated dialog when the widget is deleted
|
775 |
* @this {element} The .widget-control-remove clicked on
|
810 |
//x is the level of the *previous* item; so if previous item was at level 4, then its parent was at level 3, and
|
811 |
//was therefore indented twice (given that a level 1 item is not indented), so number of outdents is x - 2!
|
812 |
//each level is indented by 2.4em; subtract 2 from x and multiply by 2.4em, then add another 2em...
|
813 |
+
return x > 1 ? '<a href="#" class="' + widgetCustomMenuWizardClass('colexp') + ' dashicons dashicons-arrow-right" style="left:-' + (((x - 2) * 1.3) + 1.1) + 'em;"> </a>' : '';
|
814 |
};
|
815 |
if(!currentmenu.length || currentmenu.data('menuid') !== menuid){
|
816 |
oc.find('.cmw-assist-items optgroup').find('option').each(function(i){
|
817 |
var self = $(this),
|
818 |
+
cmwData = self.data(),
|
819 |
+
level = cmwData.cmwLevel,
|
820 |
+
itemType = (cmwData.cmwType || '');
|
821 |
while(level < trace.length){
|
822 |
menu += '</li></ul>' + outdentedExpander(trace.length);
|
823 |
trace.pop();
|
831 |
//data-level is 1-based, with 1 being root
|
832 |
//data-trace is the menu item ids of this item's ancestors, from root down to parent (inclusive)
|
833 |
menu += '<li class="level-' + level + '" data-itemid="' + this.value + '" data-level="' + level + '" data-trace="' + trace.join(',') + '">';
|
834 |
+
menu += '<a href="#" class="cmw-cross cmw-corners"></a>';
|
835 |
+
menu += '<a class="cmw-item cmw-corners" href="#" data-indx="' + i + '"><span class="cmw-corners" title="#' + this.value + ' ' + itemType + '">';
|
836 |
+
menu += '<strong>' + $.trim(self.text()) + '</strong>';
|
837 |
+
menu += '<i class="cmw-item-extra"><i>' + this.value + '</i>' + itemType + '</i>';
|
838 |
+
menu += '</span></a><a href="#" class="cmw-tick cmw-corners"></a>';
|
839 |
trace.push(this.value);
|
840 |
if(level > maxLevel){
|
841 |
maxLevel = level;
|
848 |
currentmenu.remove();
|
849 |
dialog.find('.cmw-demo-themenu')
|
850 |
.append( $(menu).addClass('cmw-demo-themenu-ul').data({maxLevel:maxLevel, menuid:menuid}) );
|
851 |
+
//set height to auto...
|
852 |
+
dialog.dialog('option', 'height', 'auto');
|
853 |
}
|
854 |
}, //end createMenu()
|
855 |
|
856 |
+
clickAssist = function(ignore){
|
857 |
/**
|
858 |
* toggles the assist dialog open/closed, creating it if necessary
|
859 |
* @this {element} A The assist anchor
|
867 |
if(!dialog.length){
|
868 |
dialog = createDialog(data).data({
|
869 |
cmwOnchange: '#' + oc.attr('id'),
|
870 |
+
cmwUntitled: '[' + getText('untitled') + ']'
|
871 |
});
|
872 |
}
|
873 |
if(dialog.dialog('isOpen')){
|
887 |
* There is a default set of functions, and any different legacy versions that are still
|
888 |
* supported should be under their own 'vNNN' object (eg. 'v210'). Which set of functions
|
889 |
* is called is determined by assistance(), which is the only entry point (into update()),
|
890 |
+
* and is governed by the widget form (specifically, the cmwInstanceVersion property of
|
891 |
+
* the data attached to the -onchange wrapper).
|
892 |
*/
|
893 |
cmwAssist = {
|
894 |
setLevels : function(oc, maxLevel){
|
905 |
theSelect.find('optgroup').each(function(i){
|
906 |
var self = $(this),
|
907 |
opts = self.find('option'),
|
908 |
+
ct = opts.length;
|
|
|
909 |
if(i){
|
910 |
//absolute...
|
911 |
opts.slice(maxLevel).remove();
|
912 |
while(ct < maxLevel){
|
913 |
+
ct += 1;
|
914 |
self.append( $('<option/>', {value:ct}).text(ct) );
|
915 |
}
|
916 |
}else{
|
921 |
//etc, etc
|
922 |
ct = (ct + 1) / 2;
|
923 |
if(ct > maxLevel){
|
924 |
+
opts.each(function(ignore, el){
|
925 |
if(Math.abs(el.value) >= maxLevel){
|
926 |
$(el).remove();
|
927 |
}
|
928 |
});
|
929 |
}
|
930 |
while(ct < maxLevel){
|
931 |
+
self.prepend( $('<option/>', {value:-ct}).text(-ct + (ct > 1 ? '' : ' (' + getText('parent') + ')')) )
|
932 |
+
.append( $('<option/>', {value:'+' + ct}).text('+' + ct + (ct > 1 ? '' : ' (' + getText('children') + ')')) );
|
933 |
+
ct += 1;
|
934 |
}
|
935 |
}
|
936 |
});
|
946 |
|
947 |
oc.find('.cmw-set-rel-abs-levels').each(function(){
|
948 |
var self = $(this),
|
949 |
+
//.cmw-title-from fields use text "level N", the others use "to level N"...
|
950 |
+
isTitleFrom = self.hasClass('cmw-title-from'),
|
951 |
optgroups = self.find('optgroup'),
|
952 |
ct = (optgroups.find('option').length / 2) + 1, //should never be below 2
|
953 |
v = self.val(),
|
958 |
if(ct !== minLevel){
|
959 |
optgroups.each(function(i, el){
|
960 |
var optgroup = $(el),
|
961 |
+
text = getText( i ? (isTitleFrom ? 'level_n' : 'to_level_n') : 'n_levels' ),
|
962 |
j;
|
963 |
if(ct > minLevel){
|
964 |
optgroup.find('option').slice( minLevel - ct ).remove();
|
965 |
}
|
966 |
+
for(j = ct; j < minLevel; j += 1){
|
967 |
optgroup.append( $('<option/>', {value:i ? j : -j}).text( text.replace('%d', i ? j : -j) ) );
|
968 |
}
|
969 |
});
|
979 |
below = options.eq(3).text();
|
980 |
options.slice( (maxLevel * 3) + 1 ).remove();
|
981 |
while(ct < maxLevel){
|
982 |
+
ct += 1;
|
983 |
self.append( $('<option/>', {value:ct}).text(ct) )
|
984 |
.append( $('<option/>', {value:ct + '-'}).text(above.replace(/\d+/, ct)) )
|
985 |
.append( $('<option/>', {value:ct + '+'}).text(below.replace(/\d+/, ct)) );
|
992 |
//do the easy levels...
|
993 |
oc.find('.cmw-set-levels').each(function(){
|
994 |
var self = $(this),
|
995 |
+
txt = self.hasClass('cmw-level') ? '%d' : getText('n_levels'),
|
996 |
+
leave = self.data('cmwSetLevels') || 0,
|
|
|
997 |
opts = self.find('option'),
|
998 |
ct = opts.length - leave;
|
999 |
//if current value exceeds maxLevel, reset to first option...
|
1004 |
self.find('option').slice(leave + maxLevel).remove();
|
1005 |
//append enough new options to bring up to maxLevel...
|
1006 |
while(ct < maxLevel){
|
1007 |
+
ct += 1;
|
1008 |
+
self.append( $('<option/>', {value:ct}).text( txt.replace('%d', ct) ) );
|
1009 |
}
|
1010 |
});
|
1011 |
}, //end cmwAssist.setLevels()
|
1021 |
notByBranch = byItems || !byBranchCheckbox.prop('checked'),
|
1022 |
menuItems = oc.find('.cmw-assist-items'),
|
1023 |
selectedItem = parseInt(menuItems.val(), 10),
|
1024 |
+
fallback, data;
|
1025 |
//change of menu? : make sure the correct optgroup of menu items is used...
|
1026 |
if(target.hasClass('cmw-select-menu')){
|
1027 |
selectedItem = swapItems(menuItems, selectedItem, target[0].selectedIndex);
|
1028 |
+
data = menuItems.find('optgroup').data() || {};
|
1029 |
+
this.setLevels(oc, data.cmwMaxLevel);
|
1030 |
//if level is changed, switch to by-level filtering...
|
1031 |
}else if(target.hasClass('cmw-level')){
|
1032 |
notByBranch = true;
|
1034 |
oc.find('.cmw-bylevel').prop('checked', notByBranch);
|
1035 |
//if by-branch's branch is changed, switch to by-branch filtering...
|
1036 |
}else if(target.is(menuItems)){
|
1037 |
+
notByBranch = false;
|
1038 |
+
byItems = false;
|
1039 |
byBranchCheckbox.prop('checked', !notByBranch);
|
1040 |
//change of items?, switch to by-items filtering...
|
1041 |
}else if(target.hasClass('cmw-setitems')){
|
1078 |
byBranch = settings.filter === 'branch',
|
1079 |
byItems = settings.filter === 'items',
|
1080 |
byLevel = !byBranch && !byItems,
|
1081 |
+
content, n;
|
1082 |
//take notice of the widget's hide_title flag...
|
1083 |
if(settings.title && !settings.hide_title){
|
1084 |
args.title = [settings.title];
|
1105 |
}
|
1106 |
//specifying items set byItems, overriding byLevel & byBranch...
|
1107 |
if(byItems){
|
1108 |
+
n = '_items'; //avoids jslint warning
|
1109 |
+
args.items = [settings[n]];
|
1110 |
}
|
1111 |
//depth is not relevant to byItems...
|
1112 |
else{
|
1147 |
args.include_level = [settings.include_level];
|
1148 |
}
|
1149 |
//exclusions by id...
|
1150 |
+
n = '_exclude'; //avoids jslint warning
|
1151 |
+
if(settings[n]){
|
1152 |
+
args.exclude = [settings[n]];
|
1153 |
}
|
1154 |
//...and by level...
|
1155 |
if(settings.exclude_level){
|
1171 |
}
|
1172 |
}
|
1173 |
//switches...
|
1174 |
+
$.each(
|
1175 |
+
[
|
1176 |
+
'siblings',
|
1177 |
+
'flat_output',
|
1178 |
+
'ol_root',
|
1179 |
+
'ol_sub',
|
1180 |
+
'fallback_ci_parent',
|
1181 |
+
'fallback_ci_lifo'
|
1182 |
+
],
|
1183 |
+
function(ignore, k){
|
1184 |
+
if(settings[k]){
|
1185 |
+
args[k] = 1;
|
1186 |
+
}
|
1187 |
}
|
1188 |
+
);
|
1189 |
//strings...
|
1190 |
+
$.each(
|
1191 |
+
{
|
1192 |
+
contains_current:'',
|
1193 |
+
container:'div',
|
1194 |
+
container_id:'',
|
1195 |
+
container_class:'',
|
1196 |
+
menu_class:'menu-widget',
|
1197 |
+
widget_class:''
|
1198 |
+
},
|
1199 |
+
function(k,v){
|
1200 |
+
if(settings[k] !== v){
|
1201 |
+
args[k] = [settings[k]];
|
1202 |
+
}
|
1203 |
}
|
1204 |
+
);
|
1205 |
+
//mappings...
|
1206 |
+
$.each(
|
1207 |
+
{
|
1208 |
+
wrap_link:'before',
|
1209 |
+
wrap_link_text:'link_before'
|
1210 |
+
},
|
1211 |
+
function(k, v){
|
1212 |
+
var m = settings[v].toString().match(/^<(\w+)/);
|
1213 |
+
if(m && m[1]){
|
1214 |
+
args[k] = [m[1]];
|
1215 |
+
}
|
1216 |
}
|
1217 |
+
);
|
1218 |
//alternative...
|
1219 |
if(settings.switch_if){
|
1220 |
if(settings.switch_at){
|
1221 |
args.alternative = [settings.switch_if, settings.switch_at];
|
1222 |
+
content = alternativeStripDown(settings.switch_to);
|
1223 |
}
|
1224 |
}
|
1225 |
//build the shortcode...
|
1226 |
+
n = [];
|
1227 |
+
$.each(args, function(k, v){
|
1228 |
//array indicates join (with comma sep) & surround it in double quotes, otherwise leave 'as-is'...
|
1229 |
+
n.push( $.isArray(v) ? k + '="' + v.join(',') + '"' : k + '=' + v );
|
1230 |
+
});
|
1231 |
//NB at v3.0.0, the shortcode changed from custom_menu_wizard to cmwizard (the previous version is still supported)
|
1232 |
+
return '[cmwizard ' + n.join(' ') + (!content ? '/]' : ']' + content + '[/cmwizard]');
|
1233 |
}, //end cmwAssist.shortcode()
|
1234 |
|
1235 |
structureUpdate : function(dialog, settings, usingAlts){
|
1299 |
|
1300 |
//primary filter : level...
|
1301 |
if(byLevel && items.length && settings.level > 1){
|
1302 |
+
j = [];
|
1303 |
+
for(i = 1; i < settings.level; i += 1){
|
1304 |
j.push('.level-' + i);
|
1305 |
}
|
1306 |
items = items.not( j.join(',') );
|
1322 |
stage = 'secondary';
|
1323 |
//secondary filter : level...
|
1324 |
if(byLevel && items.length && local_depth){
|
1325 |
+
i = ( local_depth_rel_current && currentItemLevel >= settings.level )
|
1326 |
//if the limited depth is relative to current item, and current item can be found at or below the start level...
|
1327 |
? currentItemLevel
|
1328 |
//set relative to start level...
|
1330 |
i += local_depth;
|
1331 |
//note that i has been set to the first level *not* wanted!
|
1332 |
if(i <= maxLevel){
|
1333 |
+
for(j = []; i <= maxLevel; i += 1){
|
1334 |
j.push('.level-' + i);
|
1335 |
}
|
1336 |
//filter to remove...
|
1343 |
//convert start level to integer...
|
1344 |
j = parseInt(settings.branch_start, 10);
|
1345 |
//convert relative to absolute (max'd against 1)...
|
1346 |
+
j = ( isNaN(j) || !j ) ? tobLevel : ( settings.branch_start.match(/^(\+|-)/) ? Math.max(1, tobLevel + j) : j );
|
1347 |
|
1348 |
//in order to be eligible for a no-kids fallback:
|
1349 |
// - branch must be current item
|
1357 |
j = maxLevel + 1;
|
1358 |
}else{
|
1359 |
//for current, fall back to tob; for parent, fall back to tob - 1, ensuring that we don't fall back further than root...
|
1360 |
+
j = ( settings.fallback === 'current' || tobLevel < 2 ) ? tobLevel : tobLevel - 1;
|
1361 |
//if fallback depth is specified, override depth and set to relative-to-current...
|
1362 |
if(settings.fallback_depth){
|
1363 |
local_depth = settings.fallback_depth;
|
1399 |
k = 9999;
|
1400 |
if(local_depth){
|
1401 |
//is (limited) depth relative to current item, and is there an eligible current item to measure against?...
|
1402 |
+
k = ( local_depth_rel_current && currentItemLevel >= tobLevel && items.filter(currentItemLI).length )
|
1403 |
? currentItemLevel
|
1404 |
: tobLevel;
|
1405 |
k += local_depth;
|
1406 |
lastVisibleLevel = k - 1;
|
1407 |
}
|
1408 |
//note that k has been set to the first level (after those wanted) that is *not* wanted!
|
1409 |
+
j = [];
|
1410 |
+
for(i = 1; i <= maxLevel; i += 1){
|
1411 |
if(i >= tobLevel && i < k){
|
1412 |
j.push('.level-' + i);
|
1413 |
}
|
1450 |
y = Math.max(1, j + y);
|
1451 |
}
|
1452 |
//get the level classes for ancestors and siblings that need to be included...
|
1453 |
+
j = [];
|
1454 |
+
k = [];
|
1455 |
+
for(i = x; i <= maxLevel; i += 1){
|
1456 |
if(i <= lastVisibleLevel){
|
1457 |
//ancestors...
|
1458 |
j.push('.level-' + i);
|
1568 |
// are being used, and prevents them being clicked on - because they can't be updated back into the current settings)...
|
1569 |
dialog.find('.cmw-demo-themenu-ul').toggleClass('cmw-using-alternative', !!usingAlts);
|
1570 |
//show/hide the inclusions/exclusions messages...
|
1571 |
+
$.each(
|
1572 |
+
{
|
1573 |
+
inclusions: hasIncl,
|
1574 |
+
exclusions: hasExcl
|
1575 |
+
},
|
1576 |
+
function(k, v){
|
1577 |
+
var el = dialog.find('.cmw-demo-' + k);
|
1578 |
+
el.text( el.text().replace(/\d+$/, v) ).toggleClass('updated', v > 0);
|
1579 |
+
}
|
1580 |
+
);
|
1581 |
|
1582 |
//toggle ticks and 'pick' the remaining items...
|
1583 |
topOfMenu.toggleClass('cmw-demo-filteritems', byItems)
|
1648 |
*/
|
1649 |
var theSelect = oc.find('.cmw-start-level'),
|
1650 |
level = theSelect.val(),
|
1651 |
+
ct = theSelect.find('option').length;
|
|
|
1652 |
if(level > maxLevel){
|
1653 |
theSelect.val(1);
|
1654 |
}
|
1655 |
theSelect.find('option').slice(maxLevel).remove();
|
1656 |
while(ct < maxLevel){
|
1657 |
+
ct += 1;
|
1658 |
theSelect.append( $('<option/>', {value:ct}).text(ct) );
|
1659 |
}
|
1660 |
theSelect = oc.find('.cmw-depth');
|
1661 |
level = theSelect.val();
|
1662 |
ct = theSelect.find('option').length;
|
|
|
1663 |
if(level > maxLevel){
|
1664 |
theSelect.val(0); //=unlimited
|
1665 |
}
|
1666 |
theSelect.find('option').slice(maxLevel + 1).remove();
|
1667 |
while(ct <= maxLevel){
|
1668 |
+
theSelect.append( $('<option/>', {value:ct}).text(ct) );
|
1669 |
+
ct += 1;
|
1670 |
}
|
1671 |
}, //end cmwAssist.v210.setLevels()
|
1672 |
|
1679 |
var showAll = oc.find('.cmw-showall').prop('checked'),
|
1680 |
showSpecific = oc.find('.cmw-showspecific').prop('checked'),
|
1681 |
menuItems = oc.find('.cmw-assist-items'),
|
1682 |
+
selectedItem = parseInt(menuItems.val(), 10),
|
1683 |
+
data;
|
1684 |
//change of menu? : make sure the correct optgroup of menu items is used...
|
1685 |
if(target.hasClass('cmw-select-menu')){
|
1686 |
selectedItem = swapItems(menuItems, selectedItem, target[0].selectedIndex);
|
1687 |
+
data = menuItems.find('optgroup').data() || {};
|
1688 |
+
this.setLevels(oc, data.cmwMaxLevel);
|
1689 |
}
|
1690 |
$.each(
|
1691 |
{ '' : showAll || showSpecific,
|
1710 |
byLevel = !settings.filter,
|
1711 |
byBranch = settings.filter > 0,
|
1712 |
byItems = !byLevel && !byBranch,
|
1713 |
+
n;
|
1714 |
if(settings.title){
|
1715 |
args.title = [settings.title];
|
1716 |
}
|
1724 |
}
|
1725 |
}
|
1726 |
if(byItems){
|
1727 |
+
n = '_items';
|
1728 |
+
args.items = [settings[n]];
|
1729 |
}
|
1730 |
if(byBranch && settings.filter_item < 0 && settings.fallback_no_ancestor){
|
1731 |
if(settings.fallback_include_parent_siblings){
|
1779 |
if(n.length){
|
1780 |
args.title_from = n;
|
1781 |
}
|
1782 |
+
$.each(
|
1783 |
+
[
|
1784 |
+
'flat_output',
|
1785 |
+
'contains_current',
|
1786 |
+
'ol_root',
|
1787 |
+
'ol_sub'
|
1788 |
+
],
|
1789 |
+
function(ignore, k){
|
1790 |
+
if(settings[k]){
|
1791 |
+
args[k] = 1;
|
1792 |
+
}
|
1793 |
}
|
1794 |
+
);
|
1795 |
+
$.each(
|
1796 |
+
{
|
1797 |
+
container:'div',
|
1798 |
+
container_id:'',
|
1799 |
+
container_class:'',
|
1800 |
+
menu_class:'menu-widget',
|
1801 |
+
widget_class:''
|
1802 |
+
},
|
1803 |
+
function(k, v){
|
1804 |
+
if(settings[k] !== v){
|
1805 |
+
args[k] = [settings[k]];
|
1806 |
+
}
|
1807 |
}
|
1808 |
+
);
|
1809 |
+
$.each(
|
1810 |
+
{
|
1811 |
+
wrap_link:'before',
|
1812 |
+
wrap_link_text:'link_before'
|
1813 |
+
},
|
1814 |
+
function(k, v){
|
1815 |
+
var m = settings[v].toString().match(/^<(\w+)/);
|
1816 |
+
if(m && m[1]){
|
1817 |
+
args[k] = [m[1]];
|
1818 |
+
}
|
1819 |
}
|
1820 |
+
);
|
1821 |
+
n = [];
|
1822 |
+
$.each(args, function(k, v){
|
1823 |
//array indicates join (with space sep) & surround it in double quotes, otherwise leave 'as-is'...
|
1824 |
+
n.push( $.isArray(v) ? k + '="' + v.join(' ') + '"' : k + '=' + v );
|
1825 |
+
});
|
1826 |
+
return '[custom_menu_wizard ' + n.join(' ') + ']';
|
1827 |
}, //end cmwAssist.v210.shortcode()
|
1828 |
|
1829 |
update : function(el){
|
1917 |
}else{
|
1918 |
j = settings.depth ? settings.start_level + settings.depth - 1 : 9999;
|
1919 |
}
|
1920 |
+
for(i = 1; i <= maxLevel; i += 1){
|
1921 |
if(i < settings.start_level || i > j){
|
1922 |
items = items.not('.level-' + i);
|
1923 |
}
|
custom-menu-wizard.min.js
CHANGED
@@ -1,62 +1,63 @@
|
|
1 |
/*Source: custom-menu-wizard.js
|
2 |
-
*Compiled: 2016-
|
3 |
*STATISTICS
|
4 |
-
* - originalSize:
|
5 |
-
* - originalGzipSize:
|
6 |
-
* - compressedSize:
|
7 |
-
* - compressedGzipSize:
|
8 |
*/
|
9 |
-
jQuery(function(
|
10 |
'use strict';
|
11 |
-
var
|
12 |
-
exclude_level:1,include_level:1},
|
13 |
-
c,d){var e=d.switch_if;return d.switch_at===b&&("current"===e&&a||"no-current"===e&&!a||"no-output"===e&&!c)},
|
14 |
-
d[3]?e[d[3]]=d[4]:d[5]?e[d[5]]=d[6]
|
15 |
-
|
16 |
-
|
17 |
-
c["title_"+
|
18 |
-
return a},F=function(b,a){var c=a.find(".cmw-demo-themenu-ul"),d=c.data(),e=
|
19 |
-
(e.push(parseInt(a,10)),!a):!!a}):[],k=d+k.join(d)+d,e=d+e.join(d)+d;b=b.each(function(){var a=
|
20 |
-
""]:[];if(0<d[0])for(e=1;e<=a;e
|
21 |
-
d.trace.toString().split(","):[];b=d.itemid.toString();var k=1,c=c.children(".cmw-item");if(!a.flat_output)for(h[b]=1,b=0;b<
|
22 |
-
|
23 |
-
b.append(d).val(a)));return a},
|
24 |
-
|
25 |
-
1<b.length&&b.shift();
|
26 |
-
a?".cmw-setitems":".cmw-exclusions"),m;!b.hasClass("cmw-using-alternative")&&
|
27 |
-
this.blur();return!1},
|
28 |
-
c=
|
29 |
-
'</em><em class="cmw-demo-plugin-version cmw-demo-small">v'+b.
|
30 |
-
|
31 |
-
a?'<a href="#" class="'+
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
a;
|
36 |
-
|
37 |
-
b.hasClass("cmw-
|
38 |
-
|
39 |
-
b.
|
40 |
-
(a.
|
41 |
-
d
|
42 |
-
|
43 |
-
if(
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
"-
|
52 |
-
(a.
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
(
|
59 |
-
g
|
60 |
-
c),
|
61 |
-
|
62 |
-
|
|
1 |
/*Source: custom-menu-wizard.js
|
2 |
+
*Compiled: 2016-04-15, Google Closure Compiler...
|
3 |
*STATISTICS
|
4 |
+
* - originalSize: 87814
|
5 |
+
* - originalGzipSize: 20231
|
6 |
+
* - compressedSize: 27257
|
7 |
+
* - compressedGzipSize: 8679
|
8 |
*/
|
9 |
+
jQuery(function(f){
|
10 |
'use strict';
|
11 |
+
var z,M=/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)/g,u=function(b){return window.Custom_Menu_Wizard_Texts?window.Custom_Menu_Wizard_Texts[b]||b:b},x=function(b,a){return(a?".":"")+"widget-custom-menu-wizard-"+b},C=function(b){var a=f(this).data().cmwInstanceVersion.replace(/\./g,""),a=/^\d+$/.test(a)?"v"+a:a;z[a]?z[a].update(b?b.target:this):z.update(b?b.target:this)},I=function(b,a){var c=!1===b,d={},e=
|
12 |
+
!c&&"2.1.0"===b.data().cmwInstanceVersion,k={items:1,exclude:1},g=f.extend({branch_start:1,exclude_level:1,include_level:1},k);f.each(c?a:b.find(":input").serializeArray(),function(a,b){var c=b.name.replace(/.*\[([^\]]+)\]$/,"$1"),h=!g[c]&&/^-?\d+$/.test(b.value)?parseInt(b.value,10):b.value;d[c]=h;k[c]&&(d["_"+c+"_sep"]=!h||/(^-?\d+\+?$|,)/.test(f.trim(h))?",":" ",h=f.map(h.split(/[,\s]+/),function(a){var b=!e&&/\+$/.test(a);a=a?parseInt(a,10):0;return isNaN(a)||!a?null:b?a+"+":a}),d["_"+c]=h.join(d["_"+
|
13 |
+
c+"_sep"]))});return d},E=function(b,a,c,d){var e=d.switch_if;return d.switch_at===b&&("current"===e&&a||"no-current"===e&&!a||"no-output"===e&&!c)},R=function(b,a){b=f.trim(b||"");for(var c={title:"",level:1,branch:0,items:"",depth:0,depth_rel_current:0,start_at:"",start_mode:"",allow_all_root:0,ancestors:0,ancestor_siblings:0,include_root:0,include_level:"",siblings:0,exclude:"",exclude_level:"",contains_current:"",fallback:"",flat_output:0,title_from:"",title_linked:0,ol_root:0,ol_sub:0},d=M.exec(b),
|
14 |
+
e={},k=0;d;)k+=1,d[1]?e[d[1]]=d[2]:d[3]?e[d[3]]=d[4]:d[5]?e[d[5]]=d[6]:--k,d=M.exec(b);k&&f.each(e,function(a,b){c[a]=b});d=!!c.items;e=!d&&!!c.branch;k=!d&&!e;d&&(c.filter="items");if(e){c.filter="branch";d=c.start_at.toString();c.branch_start=d;if("0"===d||"branch"===d)c.branch_start="";"root"===d&&(c.branch_start="1");"children"===d&&(c.branch_start="+1");"parent"===d&&(c.branch_start="-1");if("current"===c.branch||"current-item"===c.branch)c.branch=0;else if(!/^[+\-]?\d+$/.test(c.branch.toString()))if(c.branch=
|
15 |
+
c.branch.toLowerCase(),d=a.find("a.cmw-item").filter(function(){return f(this).text().toLowerCase()===c.branch}),d.length)c.branch=d.parent().data("itemid");else return!1}k&&(c.filter="",c.level=Math.max(1,parseInt(c.level,10)));c.start_at=null;c.include_level||"1"!==c.include_root||(c.include_level="1");c.include_root=null;if(e&&!c.branch&&c.fallback&&(e=c.fallback.toLowerCase().split(/[\s,]+/),d=" "+e.join(" ")+" ",c.fallback="",0<=d.indexOf(" quit ")?c.fallback="quit":0<=d.indexOf(" parent ")?
|
16 |
+
c.fallback="parent":0<=d.indexOf(" current ")&&(c.fallback="current"),""!==c.fallback&&"quit"!==c.fallback))for(0<=d.indexOf(" +siblings ")&&(c.fallback_siblings=1),k=0;k<e.length;k+=1)if(/^\d+$/.test(e[k])&&(d=parseInt(e[k],10),0<d)){c.fallback_depth=d;break}if(c.title_from)for(e=c.title_from.toLowerCase().split(/[\s,]+/),k=0;k<e.length;k+=1)if(e[k])if("branch"===e[k]||"current"===e[k])c["title_"+e[k]]="0";else if(d=e[k].match(/^(branch|current)(-root|-parent|[+\-]?\d+)$/))"-root"===d[2]?c["title_"+
|
17 |
+
d[1]]=1:"-parent"===d[2]?c["title_"+d[1]]=-1:(c["title_"+d[1]]=d[2],c["title_"+d[1]]||(c["title_"+d[1]]=""));c.title_from=null;return I(!1,f.map(c,function(a,b){return null===a?a:{name:b,value:a}}))},N=function(b){var a="";b&&(a=b.replace(/[\r\n\t]+/g," ").replace(/^[\[\s]+/,"").replace(/[\s\/\]]+$/,"").split(/[\[\]]/)[0],a=f.trim(a.replace(/\/+$/,""))+" ",a=" "+a.replace(/^cmwizard\s/,"")+" ",a=f.trim(a.replace(/\s(menu|widget)=[^\s]*/g," ").replace(/\salternative=("[^"]*"|[^\s]*)/g," ")),a=a.replace(/\s\s+/g,
|
18 |
+
" "));return a},F=function(b,a){var c=a.find(".cmw-demo-themenu-ul"),d=c.data(),e=N(b.switch_to),e="cmwizard menu="+b.menu+(""===e?e:" "+e);d.altCode&&d.altCode===e||(d.altCode=e,d.altSettings=R(e,c));a.find(".cmw-demo-alternative").addClass("updated").toggleClass("error",!1===d.altSettings);return!1===d.altSettings?!1:f.extend({},d.altSettings)},J=function(b,a,c){var d="tick"===c?"_items_sep":"_exclude_sep",e=[],k="tick"===c?"_items":"_exclude",d=a[d],k=a[k]?f.grep(a[k].split(d),function(a){return/\+$/.test(a)?
|
19 |
+
(e.push(parseInt(a,10)),!a):!!a}):[],k=d+k.join(d)+d,e=d+e.join(d)+d;b=b.each(function(){var a=f(this),b=a.data(),p=-1<e.indexOf(d+b.itemid+d),b=p||-1<k.indexOf(d+b.itemid+d);a.toggleClass("cmw-has-"+c,b).toggleClass("cmw-inherit-"+c,p)});return b.filter(".cmw-inherit-"+c).find("li").removeClass("cmw-has-"+c+" cmw-inherit-"+c).add(b.filter(".cmw-has-"+c))},y=function(b,a){return b[a?"find":"closest"](x("onchange",1))},O=function(b,a){var c=[],d=b.match(/^(\d+)(\+|-)?$/),e,d=d?[parseInt(d[1],10),d[2]||
|
20 |
+
""]:[];if(0<d[0])for(e=1;e<=a;e+=1)(e===d[0]||"-"===d[1]&&e<d[0]||"+"===d[1]&&e>d[0])&&c.push(".level-"+e);return c.join(",")},P=function(b,a){var c=b.find(".cmw-demo-themenu-ul"),d=c.find(".picked"),e="",k=a.hide_title?"":a.title,g=0,m=0,p=b.find(".cmw-demo-theoutput-wrap").empty(),r=["menu-widget"],h={};if(d.length&&p.length){k=c.find(".title-from-item").children(".cmw-item").find("strong").text()||"";g=!!k&&!!a.title_linked;k||a.hide_title||(k=a.title||"");for(d.each(function(b){var c=f(this),
|
21 |
+
d=c.data(),g=d.trace?d.trace.toString().split(","):[];b=d.itemid.toString();var k=1,c=c.children(".cmw-item");if(!a.flat_output)for(h[b]=1,b=0;b<g.length;b+=1)h[g[b]]&&(k+=1);if(m)if(k>m)e+=a.ol_sub?"<ol>":"<ul>";else{for(;m>k;)--m,e+="</li>"+(a.ol_sub?"</ol>":"</ul>");e+="</li>"}e+='<li class="cmw-level-'+k+(d.included||"")+'"><a href="#'+c.data("indx")+'">'+c.find("strong").text()+"</a>";m=k});1<m;)--m,e+="</li>"+(a.ol_sub?"</ol>":"</ul>");e+="</li>";r.push(b.find(".cmw-demo-fallback").data("fellback"));
|
22 |
+
e=(a.ol_root?"<ol":"<ul")+' class="'+f.trim(r.join(" "))+'">'+e+(a.ol_root?"</ol>":"</ul>");p.html(e);p.find("li").filter(function(){return!!f(this).children("ul, ol").length}).addClass("cmw-has-submenu")}p.length&&k&&d.length&&p.prepend((g?'<h3 class="cmw-title-linked">':"<h3>")+k+"</h3>")},Q=function(b,a,c){var d;b.find("optgroup").filter(function(){var a=f(this).data().cmwOptgroupIndex===c;a||f(this).remove();return a}).length||(d=f("#"+b.attr("id")+"_ignore").find("optgroup").eq(c).clone(),d.length&&
|
23 |
+
(0<a&&(a=0),b.append(d).val(a)));return a},S=function(b){b=f(this);var a=b.data(),c=!a.cmwAbsolute,d=b.closest(".ui-dialog"),e=d.find(".ui-dialog-content"),k=parseInt(d.css("top"),10)+(c?1:-1)*f(document).scrollTop();a.cmwAbsolute=c;a.cmwMaxHeight||(a.cmwMaxHeight=e.dialog("option","maxHeight"));b.children("span").toggleClass("dashicons-no-alt",c);d.toggleClass("cmw-assistance-dialog-fixed",!c);e.dialog("option",{maxHeight:c?!c:a.cmwMaxHeight});d.css("top",k);return!1},T=function(b){f(this).closest(".widget-custom-menu-wizard-dialog").toggleClass("cmw-show-item-extras");
|
24 |
+
this.blur();return!1},U=function(b){var a=f(this);b=["current-menu-item","current-menu-parent","current-menu-ancestor"];var c=a.closest(".ui-dialog-content"),d=c.find(".cmw-demo-themenu-ul"),a=a.find("span").not("."+b[0]).parentsUntil(d,"li"),e,k=function(){this.title=this.title+" : "+e.replace(" "," & ").replace(/-/g," ")};d.find("."+b.join(",.")).removeClass(b.join(" ")).each(function(){this.title=this.title.replace(/\s:\s.*$/,"")});for(d=0;d<a.length;d+=1)e=1===d?b.join(" "):b[0],a.eq(d).children(".cmw-item").find("span").addClass(e).each(k),
|
25 |
+
1<b.length&&b.shift();C.call(f(c.data().cmwOnchange).get(0));this.blur();return!1},V=function(b){f(this).closest(".ui-dialog-content").find(".cmw-item").eq(this.href.split("#")[1]).not(":has(.current-menu-item)").trigger("click");this.blur();return!1},W=function(b){b=f(this);var a=b.hasClass("cmw-tick")?"tick":"cross",c=b.parent();b=c.closest(".cmw-demo-themenu-ul");var d=c.hasClass("cmw-inherit-"+a),e=d||c.hasClass("cmw-has-"+a),k=e?f([]):c.parentsUntil(b,".cmw-inherit-"+a),g=f(c.closest(".ui-dialog-content").data().cmwOnchange).find("tick"===
|
26 |
+
a?".cmw-setitems":".cmw-exclusions"),m;!b.hasClass("cmw-using-alternative")&&g.length&&(m=b.find(".cmw-has-"+a)[d||k.length?"not":"add"](c),!e||c.children("ul").length&&!b.parent().hasClass("cmw-version-210")?e&&!d&&(m=m.not(c.find(".cmw-has-"+a))):m=m.not(c),m=m.add(k.find("li").not(c)),m=m.map(function(){var b=this===c[0]||this===k.get(0)?e:f(this).hasClass("cmw-inherit-"+a);return f(this).data().itemid+(b?"+":"")}).get().join(/(,|^-?\d+\+?$)/.test(f.trim(g.val())||",")?",":" "),g.val(m).trigger("change"));
|
27 |
+
this.blur();return!1},X=function(b){var a={autoOpen:!1,width:Math.min(.9*f(window).width(),600),maxHeight:f(window).height()-40,modal:!1,containment:"window",create:function(){var a=f(this).closest(".ui-dialog");a.hasClass("cmw-assistance-dialog-fixed")&&f("<a/>").addClass("cmw-dialog-fixed-absolute button-secondary").append(f("<span/>").addClass("dashicons-before dashicons-yes").text(u("fixed"))).on("click",S).appendTo(a.find(".ui-dialog-titlebar"))},dragStop:function(){f(this).dialog("option","height",
|
28 |
+
"auto")},dialogClass:"cmw-assistance-dialog cmw-assistance-dialog-fixed"},c=f.map(["setcurrent","inclusions","exclusions","fallback","alternative"],function(a){return'<div class="cmw-demo-'+a+' cmw-demo-small">'+u(a)+"</div>"});b=f("<div/>",{id:b.cmwDialogId}).addClass(x("dialog")).append(f("<div/>").addClass("cmw-demo-themenu cmw-version-"+b.cmwInstanceVersion.replace(/\./g,"")).html('<em class="cmw-demo-small">'+u("prompt")+"</em>")).append(f("<div/>").addClass("cmw-demo-theoutput cmw-corners").html('<em class="cmw-demo-small">'+
|
29 |
+
u("output")+'</em><em class="cmw-demo-plugin-version cmw-demo-small">v'+b.cmwInstanceVersion+"</em>"+c.shift()+'<div class="cmw-demo-theoutput-wrap cmw-corners"></div>'+c.join(""))).append(f("<div/>").addClass("cmw-demo-theshortcode").html('<code class="cmw-corners"></code><a class="button-secondary cmw-toggle-item-extras"><span>'+u("more")+"</span><span>"+u("less")+'</span></a><div class="cmw-find-shortcodes"><a href="#" class="button-secondary '+x("find-shortcodes")+'" data-nonce="'+(b.cmwDialogNonce||
|
30 |
+
"")+'" title="'+u("shortcodes")+'"><span class="spinner"></span><span>[…]</span></a></div><div class="cmw-demo-found-shortcodes cmw-demo-small cmw-corners"></div>'));b.dialog(a);b.on("click",".cmw-toggle-item-extras",T).find(".cmw-demo-themenu").on("click",".cmw-tick,.cmw-cross",W).on("click",".cmw-item",U);b.find(".cmw-demo-theoutput").on("click","a",V);return b},K=function(b,a){var c=a.find(".cmw-widget-title").val()||b.data().cmwUntitled;b.dialog("option","title","CMW : "+c+" ["+a.find(".cmw-select-menu").find("option:selected").text()+
|
31 |
+
"]")},L=function(b){var a=f(b.data().cmwOnchange),c=parseInt(a.find(".cmw-select-menu").val(),10),d=b.find(".cmw-demo-themenu-ul"),e=[],k=0,g="",m=function(a){return 1<a?'<a href="#" class="'+x("colexp")+' dashicons dashicons-arrow-right" style="left:-'+(1.3*(a-2)+1.1)+'em;"> </a>':""};if(!d.length||d.data("menuid")!==c){for(a.find(".cmw-assist-items optgroup").find("option").each(function(a){for(var b=f(this),c=b.data(),d=c.cmwLevel,c=c.cmwType||"";d<e.length;)g+="</li></ul>"+m(e.length),e.pop();
|
32 |
+
d>e.length?g+="<ul>":(g+="</li>",e.pop());g+='<li class="level-'+d+'" data-itemid="'+this.value+'" data-level="'+d+'" data-trace="'+e.join(",")+'">';g+='<a href="#" class="cmw-cross cmw-corners"></a>';g+='<a class="cmw-item cmw-corners" href="#" data-indx="'+a+'"><span class="cmw-corners" title="#'+this.value+" "+c+'">';g+="<strong>"+f.trim(b.text())+"</strong>";g+='<i class="cmw-item-extra"><i>'+this.value+"</i>"+c+"</i>";g+='</span></a><a href="#" class="cmw-tick cmw-corners"></a>';e.push(this.value);
|
33 |
+
d>k&&(k=d)});e.length;)g+="</li></ul>"+m(e.length),e.pop();d.remove();b.find(".cmw-demo-themenu").append(f(g).addClass("cmw-demo-themenu-ul").data({maxLevel:k,menuid:c}));b.dialog("option","height","auto")}};z={setLevels:function(b,a){var c=b.find(".cmw-branch-start"),d=c.val();a&&(c.find("optgroup").each(function(b){var c=f(this),d=c.find("option"),m=d.length;if(b)for(d.slice(a).remove();m<a;)m+=1,c.append(f("<option/>",{value:m}).text(m));else for(m=(m+1)/2,m>a&&d.each(function(b,c){Math.abs(c.value)>=
|
34 |
+
a&&f(c).remove()});m<a;)c.prepend(f("<option/>",{value:-m}).text(-m+(1<m?"":" ("+u("parent")+")"))).append(f("<option/>",{value:"+"+m}).text("+"+m+(1<m?"":" ("+u("children")+")"))),m+=1}),/^\d+$/.test(d)?d>a&&c.val("1"):""!==d&&Math.abs(d)>=a&&c.val(""),b.find(".cmw-set-rel-abs-levels").each(function(){var b=f(this),c=b.hasClass("cmw-title-from"),d=b.find("optgroup"),m=d.find("option").length/2+1,p=b.val(),r=Math.max(2,a);Math.abs(p)>=a&&b.val(0>p?1-a:a-1);m!==r&&d.each(function(a,b){var d=f(b),e=
|
35 |
+
u(a?c?"level_n":"to_level_n":"n_levels"),g;m>r&&d.find("option").slice(r-m).remove();for(g=m;g<r;g+=1)d.append(f("<option/>",{value:a?g:-g}).text(e.replace("%d",a?g:-g)))})}),b.find(".cmw-include-level,.cmw-exclude-level").each(function(){var b=f(this),c=b.find("option"),d=(c.length-1)/3,m=b.val(),p=c.eq(2).text(),r=c.eq(3).text();for(c.slice(3*a+1).remove();d<a;)d+=1,b.append(f("<option/>",{value:d}).text(d)).append(f("<option/>",{value:d+"-"}).text(p.replace(/\d+/,d))).append(f("<option/>",{value:d+
|
36 |
+
"+"}).text(r.replace(/\d+/,d)));parseInt(m,10)>a&&b.val("")}),b.find(".cmw-set-levels").each(function(){var b=f(this),c=b.hasClass("cmw-level")?"%d":u("n_levels"),d=b.data("cmwSetLevels")||0,m=b.find("option"),p=m.length-d;b.val()>a&&b.val(m.eq(0).val());for(b.find("option").slice(d+a).remove();p<a;)p+=1,b.append(f("<option/>",{value:p}).text(c.replace("%d",p)))}))},setFields:function(b,a){var c=a.find(".cmw-bybranch"),d=a.find(".cmw-byitems").prop("checked"),e=d||!c.prop("checked"),k=a.find(".cmw-assist-items"),
|
37 |
+
g=parseInt(k.val(),10);b.hasClass("cmw-select-menu")?(g=Q(k,g,b[0].selectedIndex),c=k.find("optgroup").data()||{},this.setLevels(a,c.cmwMaxLevel)):b.hasClass("cmw-level")?(e=!0,d=!e,a.find(".cmw-bylevel").prop("checked",e)):b.is(k)?(d=e=!1,c.prop("checked",!e)):b.hasClass("cmw-setitems")?(e=d=!0,a.find(".cmw-byitems").prop("checked",d)):b.hasClass("cmw-ancestors")&&"0"===b.val()?a.find(".cmw-ancestor-siblings").val("0"):b.hasClass("cmw-ancestor-siblings")&&"0"!==b.val()&&"0"===a.find(".cmw-ancestors").val()&&
|
38 |
+
a.find(".cmw-ancestors").val(b.val());c=a.find(".cmw-fallback").val();f.each({"-ss":d,"-ud":d||1>a.find(".cmw-depth").val(),"not-br":e,"not-br-ci":e||!!g,"not-fb-pc":e||!!g||"parent"!==c&&"current"!==c,"not-sw":!!a.find(".cmw-switchable").filter(function(){return!f(this).val()}).length},function(b,c){a.find(".cmw-disableif"+b).toggleClass("cmw-colour-grey",c)})},shortcode:function(b){var a={menu:b.menu},c="branch"===b.filter,d="items"===b.filter,e,k;b.title&&!b.hide_title&&(a.title=[b.title]);!c&&
|
39 |
+
!d&&1<b.level&&(a.level=b.level);c&&(a.branch=b.branch||"current",b.branch_start&&(a.start_at=[b.branch_start]),"level"===b.start_mode&&(a.start_mode=["level"]),b.allow_all_root&&(a.allow_all_root=1));d?(k="_items",a.items=[b[k]]):(0<b.depth&&(a.depth=b.depth),b.depth_rel_current&&0<b.depth&&(a.depth_rel_current=1));c&&!b.branch&&b.fallback&&(a.fallback=[b.fallback],"quit"!==b.fallback&&(b.fallback_siblings&&a.fallback.push("+siblings"),b.fallback_depth&&a.fallback.push(b.fallback_depth)));c&&b.ancestors&&
|
40 |
+
(a.ancestors=b.ancestors,b.ancestor_siblings&&(a.ancestor_siblings=b.ancestor_siblings));b.include_level&&(a.include_level=[b.include_level]);k="_exclude";b[k]&&(a.exclude=[b[k]]);b.exclude_level&&(a.exclude_level=[b.exclude_level]);k=[];""!==b.title_current&&k.push("current"+(b.title_current?b.title_current:""));c&&""!==b.title_branch&&k.push("branch"+(b.title_branch?b.title_branch:""));k.length&&(a.title_from=k,b.title_linked&&(a.title_linked=1));f.each("siblings flat_output ol_root ol_sub fallback_ci_parent fallback_ci_lifo".split(" "),
|
41 |
+
function(c,d){b[d]&&(a[d]=1)});f.each({contains_current:"",container:"div",container_id:"",container_class:"",menu_class:"menu-widget",widget_class:""},function(c,d){b[c]!==d&&(a[c]=[b[c]])});f.each({wrap_link:"before",wrap_link_text:"link_before"},function(c,d){var e=b[d].toString().match(/^<(\w+)/);e&&e[1]&&(a[c]=[e[1]])});b.switch_if&&b.switch_at&&(a.alternative=[b.switch_if,b.switch_at],e=N(b.switch_to));k=[];f.each(a,function(a,b){k.push(f.isArray(b)?a+'="'+b.join(",")+'"':a+"="+b)});return"[cmwizard "+
|
42 |
+
k.join(" ")+(e?"]"+e+"[/cmwizard]":"/]")},structureUpdate:function(b,a,c){var d=-1,e=9999,k=0,g=0,m="",p=null,r,h,q,n,v="menu",t="branch"===a.filter,u="items"===a.filter,x=!t&&!u,y=t&&!a.branch,G=!c&&!!a.switch_if&&!!a.switch_at,B=b.find(".cmw-demo-themenu-ul"),A=B.data().maxLevel,w=B.find(".current-menu-item").closest("li"),D=w.length?w.data().level:-1,l=B.find("li").removeData("included").removeClass("title-from-item"),H=a.depth,z=a.depth_rel_current,C=J(l,a,"cross");h=l.length&&w.is(l);a.contains_current!==
|
43 |
+
v||h||(l=f([]));if(G&&E(v,h,l.length,a)&&(p=F(a,b),!1!==p))return p;v="primary";u&&l.length&&(l=J(l,a,"tick"));t&&l.length&&(q=y?w:l.filter("[data-itemid="+a.branch+"]"),q.length?(d=q.data().level||0,l=q.add(q.find("li")),r=q):l=f([]));if(x&&l.length&&1<a.level){h=[];for(n=1;n<a.level;n+=1)h.push(".level-"+n);l=l.not(h.join(","))}h=l.length&&w.is(l);a.contains_current!==v||h||(l=f([]));if(G&&E(v,h,l.length,a)&&(p=F(a,b),!1!==p))return p;v="secondary";if(x&&l.length&&H&&(n=z&&D>=a.level?D:a.level,
|
44 |
+
n+=H,n<=A)){for(h=[];n<=A;n+=1)h.push(".level-"+n);l=l.not(h.join(","))}if(t&&l.length&&(h=parseInt(a.branch_start,10),h=isNaN(h)||!h?d:a.branch_start.match(/^(\+|-)/)?Math.max(1,d+h):h,y&&a.fallback&&!w.find("li").length&&(m="cmw-fellback-to-"+a.fallback,"quit"===a.fallback?h=A+1:(h="current"===a.fallback||2>d?d:d-1,a.fallback_depth&&(H=a.fallback_depth,z=1))),h>A?l=f([]):(h<d&&(q=q.parentsUntil(B,"li.level-"+h)),"level"===a.start_mode&&h<=d&&(1<h||a.allow_all_root)?l=q.parent().find("li"):h<d&&
|
45 |
+
(l=q.add(q.find("li"))),m&&a.fallback_siblings&&l.length&&(1<h||a.allow_all_root)&&(l=l.add(q.siblings("li.level-"+h)))),l.length)){d=h;q=9999;H&&(q=z&&D>=d&&l.filter(w).length?D:d,q+=H,e=q-1);h=[];for(n=1;n<=A;n+=1)n>=d&&n<q&&h.push(".level-"+n);l=l.filter(h.join(","))}h=l.length&&w.is(l);a.contains_current!==v||h||(l=f([]));if(G&&E(v,h,l.length,a)&&(p=F(a,b),!1!==p))return p;v="inclusions";if(t&&l.length){h=r.data().level;if(a.ancestors&&(r.is(l)||h>e)){n=a.ancestors;0>n&&(n=Math.max(1,h+n));d=
|
46 |
+
a.ancestor_siblings;0>d&&(d=Math.max(1,h+d));h=[];for(q=[];n<=A;n+=1)n<=e&&(h.push(".level-"+n),0<d&&n>=d&&q.push(".level-"+n));n=l.length;h=r.parentsUntil(B,h.join(","));l=l.add(h.not(l).data("included"," cmw-an-included-ancestor"));q.length&&(l=l.add(h.filter(q.join(",")).siblings("li").not(l).data("included"," cmw-an-included-ancestor-sibling")));k+=l.length-n}a.siblings&&r.is(l)&&(h=l.length,l=l.add(r.siblings("li").data("included"," cmw-an-included-sibling")),k+=l.length-h)}l.length&&a.include_level&&
|
47 |
+
(q=O(a.include_level,A))&&(h=l.length,l=l.add(B.find(q)),k+=l.length-h);h=l.length&&w.is(l);a.contains_current!==v||h||(l=f([]));if(G&&E(v,h,l.length,a)&&(p=F(a,b),!1!==p))return p;v="output";l.length&&C.length&&(h=l.length,l=l.not(C),g+=h-l.length);l.length&&a.exclude_level&&(q=O(a.exclude_level,A))&&(h=l.length,l=l.not(q),g+=h-l.length);h=l.length&&w.is(l);a.contains_current!==v||h||(l=f([]));if(G&&E(v,h,l.length,a)&&(p=F(a,b),!1!==p))return p;""!==a.title_current&&w.length?0===a.title_current?
|
48 |
+
w.addClass("title-from-item"):(n=0<a.title_current?Math.min(D,a.title_current):Math.max(1,D+a.title_current),w.closest(".level-"+n).addClass("title-from-item")):t&&r&&""!==a.title_branch&&(0===a.title_branch?r.addClass("title-from-item"):(n=r.data().level,n=0<a.title_branch?Math.min(n,a.title_branch):Math.max(1,n+a.title_branch),r.closest(".level-"+n).addClass("title-from-item")));b.find(".cmw-demo-fallback").data("fellback",m).toggleClass("updated",!!m);b.find(".cmw-demo-setcurrent").toggleClass("error",
|
49 |
+
!w.length&&(!!a.contains_current||y));c||null!==p||b.find(".cmw-demo-alternative").removeClass("error updated");b.find(".cmw-demo-themenu-ul").toggleClass("cmw-using-alternative",!!c);f.each({inclusions:k,exclusions:g},function(a,c){var d=b.find(".cmw-demo-"+a);d.text(d.text().replace(/\d+$/,c)).toggleClass("updated",0<c)});B.toggleClass("cmw-demo-filteritems",u).find(".picked").not(l.addClass("picked")).removeClass("picked");return!1},update:function(b){var a=f(b);b=y(a);var c=f("#"+b.data().cmwDialogId),
|
50 |
+
d;a.hasClass("cmw-listen")&&this.setFields(a,b);d=I(b);c.length&&c.dialog("isOpen")&&(c.dialog("moveToTop"),a.hasClass("cmw-select-menu")&&L(c),a=this.structureUpdate(c,d),!1!==a&&this.structureUpdate(c,a,!0),K(c,b),P(c,a||d));b.add(c).find("code").not(".cmw-instance-shortcode").text(this.shortcode(d))},v210:{setLevels:function(b,a){var c=b.find(".cmw-start-level"),d=c.val(),e=c.find("option").length;d>a&&c.val(1);for(c.find("option").slice(a).remove();e<a;)e+=1,c.append(f("<option/>",{value:e}).text(e));
|
51 |
+
c=b.find(".cmw-depth");d=c.val();e=c.find("option").length;d>a&&c.val(0);for(c.find("option").slice(a+1).remove();e<=a;)c.append(f("<option/>",{value:e}).text(e)),e+=1},setFields:function(b,a){var c=a.find(".cmw-showall").prop("checked"),d=a.find(".cmw-showspecific").prop("checked"),e=a.find(".cmw-assist-items"),k=parseInt(e.val(),10);b.hasClass("cmw-select-menu")&&(k=Q(e,k,b[0].selectedIndex),e=e.find("optgroup").data()||{},this.setLevels(a,e.cmwMaxLevel));f.each({"":c||d,"-ss":d,"not-rp":c||d||
|
52 |
+
0<=k,"not-ci":c||d||!!k},function(b,c){a.find(".cmw-disableif"+b).toggleClass("cmw-colour-grey",c).find("input,select").prop("disabled",c)})},shortcode:function(b){var a={menu:b.menu},c=!b.filter,d=0<b.filter,e;b.title&&(a.title=[b.title]);if(d)switch(b.filter_item){case 0:a.children_of=["current"];break;case -1:a.children_of=["parent"];break;case -2:a.children_of=["root"];break;default:a.children_of=b.filter_item}c||d||(e="_items",a.items=[b[e]]);d&&0>b.filter_item&&b.fallback_no_ancestor&&(a.fallback_parent=
|
53 |
+
b.fallback_include_parent_siblings?["siblings"]:b.fallback_include_parent?["parent"]:1);d&&!b.filter_item&&b.fallback_no_children&&(a.fallback_current=b.fallback_nc_include_parent_siblings?["siblings"]:b.fallback_nc_include_parent?["parent"]:1);1<b.start_level&&(a.start_level=b.start_level);0<b.depth&&(a.depth=b.depth);b.depth_rel_current&&0<b.depth&&(a.depth_rel_current=1);e=[];d&&(b.include_parent_siblings?e.push("siblings"):b.include_parent&&e.push("parent"),b.include_ancestors&&e.push("ancestors"),
|
54 |
+
e.length&&(a.include=e));e=[];d&&b.title_from_parent&&e.push("parent");b.title_from_current&&e.push("current");e.length&&(a.title_from=e);f.each(["flat_output","contains_current","ol_root","ol_sub"],function(c,d){b[d]&&(a[d]=1)});f.each({container:"div",container_id:"",container_class:"",menu_class:"menu-widget",widget_class:""},function(c,d){b[c]!==d&&(a[c]=[b[c]])});f.each({wrap_link:"before",wrap_link_text:"link_before"},function(c,d){var e=b[d].toString().match(/^<(\w+)/);e&&e[1]&&(a[c]=[e[1]])});
|
55 |
+
e=[];f.each(a,function(a,b){e.push(f.isArray(b)?a+'="'+b.join(" ")+'"':a+"="+b)});return"[custom_menu_wizard "+e.join(" ")+"]"},update:function(b){var a=f(b);b=y(a);var c=f("#"+b.data().cmwDialogId),d,e,k,g,m,p,r,h,q,n,v,t,u;a.hasClass("cmw-listen")&&this.setFields(a,b);if(c.length&&c.dialog("isOpen")){c.dialog("moveToTop");a.hasClass("cmw-select-menu")&&L(c);g=I(b);d=!g.filter;a=0<g.filter;e=!d&&!a;m=g.include_parent;p=g.include_parent_siblings;r=c.find(".cmw-demo-themenu-ul");k=r.data().maxLevel;
|
56 |
+
q=r.find(".current-menu-item").closest("li");n=q.length?q.data().level:-1;h=r.find("li").removeData("included").removeClass("title-from-item");e&&(h=J(h,g,"tick"));h.length&&!q.length&&(g.contains_current||a&&1>g.filter_item)&&(h=f([]));h.length&&a&&(0<g.filter_item?t=h.filter("[data-itemid="+g.filter_item+"]"):g.filter_item?1===n&&g.fallback_no_ancestor?(t=q,m=m||g.fallback_include_parent,p=p||g.fallback_include_parent_siblings,v="cmw-fellback-to-current"):t=1===n?r:-1>g.filter_item?r.find(".current-menu-ancestor").eq(0).closest("li"):
|
57 |
+
r.find(".current-menu-parent").closest("li"):q.find("li").length?t=q:g.fallback_no_children&&(t=r.find(".current-menu-parent").closest("li"),t.length||(t=r),m=m||g.fallback_nc_include_parent,p=p||g.fallback_nc_include_parent_siblings,v="cmw-fellback-to-parent"));if(h.length)if(d)for(u=g.depth_rel_current&&g.depth&&q.length&&n>=g.start_level?n+g.depth-1:g.depth?g.start_level+g.depth-1:9999,d=1;d<=k;d+=1){if(d<g.start_level||d>u)h=h.not(".level-"+d)}else t&&t.length?(u=g.depth_rel_current&&g.depth&&
|
58 |
+
q.length&&t.has(q[0]).length?n-1+g.depth:g.depth?Math.max((t.data().level||0)+g.depth,g.start_level+g.depth-1):9999,h=t.find("li").filter(function(){var a=f(this).data().level;return a>=g.start_level&&a<=u})):a&&(h=f([]));h.length&&a&&t&&t.is("li")&&(p&&(h=h.add(t.siblings("li").data("included"," cmw-an-included-parent-sibling")),m=!0),g.include_ancestors&&(h=h.add(t.parentsUntil(r,"li").data("included"," cmw-an-included-ancestor")),m=!0),m&&(h=h.add(t.data("included"," cmw-the-included-parent"))));
|
59 |
+
!h.length||!g.contains_current||q.length&&h.filter(q).length||(h=f([]));g.title_from_parent&&h.length&&t&&t.is("li")?t.addClass("title-from-item"):g.title_from_current&&h.length&&q.addClass("title-from-item");v=h.length?v:"";c.find(".cmw-demo-fallback").data("fellback",v).toggleClass("updated",!!v);c.find(".cmw-demo-setcurrent").toggleClass("error",!q.length&&(g.contains_current||a&&1>g.filter_item));r.toggleClass("cmw-demo-filteritems",e).find(".picked").not(h.addClass("picked")).removeClass("picked");
|
60 |
+
K(c,b);P(c,g);c.find("code").text(this.shortcode(g))}}}};f(document).on("change",x("onchange",1),C).on("click",x("assist",1),function(b){b=f(this);b=y(b);var a=b.data(),c=f("#"+a.cmwDialogId);c.length||(c=X(a).data({cmwOnchange:"#"+b.attr("id"),cmwUntitled:"["+u("untitled")+"]"}));c.dialog("isOpen")?c.dialog("close"):(L(c),K(c,b),c.dialog("open"),C.call(b[0]));this.blur();return!1}).on("click",x("fieldset",1),function(b){b=f(this);var a=b.next(".cmw-fieldset-state"),c=!a.prop("checked");a.length&&
|
61 |
+
(a.prop("checked",c),b.toggleClass("cmw-collapsed-fieldset",c),a.next("div")[c?"slideUp":"slideDown"]("fast"));this.blur();return!1}).on("click",".widget-action,.widget-control-close",function(b){b=f(this).closest("div.widget");var a=b.parent();a.hasClass("customize-control-widget_form")&&!a.hasClass("expanded")||y(b,1).each(function(){var a=f("#"+f(this).data().cmwDialogId);a.length&&a.dialog("isOpen")&&a.dialog("close")})}).on("click",".widget-control-remove",function(b){b=f(this).closest("div.widget");
|
62 |
+
y(b,1).each(function(){var a=f("#"+f(this).data().cmwDialogId);a.length&&(a.dialog("destroy"),a.remove())})}).on("click",x("colexp",1),function(b){b=/w-r/.test(this.className)?"slideUp":"slideDown";f(this).toggleClass("dashicons-arrow-right dashicons-arrow-down").prev("ul")[b]("fast");this.blur();return!1}).on("click",x("find-shortcodes",1),function(b){b=f(this);var a=b.parent().parent();ajaxurl&&!a.hasClass("cmw-ajax-fetching")&&(a.hasClass("cmw-ajax-showing")?a.removeClass("cmw-ajax-showing"):(a.addClass("cmw-ajax-fetching"),
|
63 |
+
f.get(ajaxurl,{action:"cmw-find-shortcodes",_wpnonce:b.data().nonce}).done(function(b){b&&"0"!==b&&(a.find(".cmw-demo-found-shortcodes").html(f(b).find("response_data").text()),a.addClass("cmw-ajax-showing"))}).always(function(){a.removeClass("cmw-ajax-fetching")})));this.blur();return!1}).on("click",x("legacy-close",1),function(){f(this).parent().remove();return!1});window.Custom_Menu_Wizard_Widget&&f(window.Custom_Menu_Wizard_Widget.trigger||[]).trigger("change")});
|
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.
|
7 |
* Author: Roger Barrett
|
8 |
* Author URI: http://www.wizzud.com/
|
9 |
* License: GPL2+
|
@@ -11,6 +11,19 @@
|
|
11 |
*/
|
12 |
defined( 'ABSPATH' ) or exit();
|
13 |
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
* v3.2.6 change log
|
15 |
* - added cmw-current-item class to the menu item that CMW is using as 'current item'
|
16 |
*
|
@@ -186,9 +199,10 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
|
|
186 |
//declare the main plugin class...
|
187 |
class Custom_Menu_Wizard_Plugin {
|
188 |
|
189 |
-
public static $version = '3.
|
190 |
public static $script_handle = 'custom-menu-wizard-plugin-script';
|
191 |
public static $widget_class = 'Custom_Menu_Wizard_Widget';
|
|
|
192 |
protected static $instance;
|
193 |
|
194 |
/**
|
@@ -198,15 +212,21 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
|
|
198 |
|
199 |
load_plugin_textdomain( basename( dirname( __FILE__ ) ), false, basename( dirname( __FILE__ ) ) . '/languages' );
|
200 |
|
|
|
201 |
add_action( 'widgets_init', array( &$this, 'widget_and_shortcode' ) );
|
202 |
-
|
203 |
add_action( 'admin_enqueue_scripts', array( &$this, 'register_scripts' ) );
|
|
|
204 |
add_action( 'admin_print_styles-widgets.php', array( &$this, 'enqueue_styles' ) );
|
205 |
add_action( 'admin_print_scripts-widgets.php', array( &$this, 'enqueue_scripts' ) );
|
206 |
-
add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
|
207 |
//add customizer support...
|
208 |
add_action( 'customize_controls_enqueue_scripts', array( &$this, 'enqueue_styles' ) );
|
209 |
add_action( 'customize_controls_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
|
|
|
|
|
|
|
|
|
|
|
210 |
//add doc link to plugin's action links...
|
211 |
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( &$this, 'plugin_actions' ), 10, 4 );
|
212 |
|
@@ -257,18 +277,9 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
|
|
257 |
* hooked into admin_print_styles-widgets.php & customize_controls_enqueue_scripts actions : queues styles needed by the plugin
|
258 |
*/
|
259 |
public function enqueue_styles(){
|
260 |
-
|
261 |
-
|
262 |
-
wp_enqueue_style( 'custom-menu-wizard-plugin-styles', plugins_url( '/custom-menu-wizard.css', __FILE__ ), array(), self::$version );
|
263 |
-
//if there's no jquery-ui style already registered, register Smoothness...
|
264 |
-
if( !wp_style_is( 'jquery-ui', 'registered' ) ) {
|
265 |
-
//get the jquery ui core version (default to 1.9.2 if not found)...
|
266 |
-
$jquery_ui_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
|
267 |
-
//register Smoothness theme for the determined ui version...
|
268 |
-
// wp_register_style( 'jquery-ui', '//ajax.googleapis.com/ajax/libs/jqueryui/' . $jquery_ui_version . '/themes/smoothness/jquery-ui.css' );
|
269 |
-
wp_register_style( 'jquery-ui', '//code.jquery.com/ui/' . $jquery_ui_version . '/themes/smoothness/jquery-ui.css' );
|
270 |
-
}
|
271 |
-
wp_enqueue_style( 'jquery-ui' );
|
272 |
|
273 |
} //end enqueue_styles()
|
274 |
|
@@ -291,6 +302,37 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
|
|
291 |
$min = defined( 'WP_DEBUG' ) && WP_DEBUG ? '' : '.min';
|
292 |
wp_register_script( self::$script_handle, plugins_url( "/custom-menu-wizard$min.js", __FILE__ ), array('jquery-ui-dialog'), self::$version, true );
|
293 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
} //end register_scripts()
|
295 |
|
296 |
/**
|
@@ -501,8 +543,13 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
|
|
501 |
$alt = trim( preg_replace( array( '/[\r\n\t]+/', '/\s\s+/' ), ' ', $alt[0] ), ' /' );
|
502 |
//remove leading 'cmwizard' tag...
|
503 |
$alt = preg_replace( '/^cmwizard\s/', '', $alt . ' ' );
|
504 |
-
//remove any occurrences of 'menu=whatever' and 'alternative="whatever"' (optional double quotes), and trim spaces...
|
505 |
-
$alt = trim( preg_replace(
|
|
|
|
|
|
|
|
|
|
|
506 |
|
507 |
return $alt;
|
508 |
|
@@ -522,7 +569,6 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
|
|
522 |
* shortcode processing for [cmwizard option="" option="" ...] (as of v3.0.0)
|
523 |
*
|
524 |
* see wp-includes/widgets.php for the_widget() code
|
525 |
-
* Note that hide_empty is set to ON and can not be overridden!
|
526 |
*
|
527 |
* differences from [custom_menu_wizard] shortcode (ie. v2.1.0)
|
528 |
* deprecated:
|
@@ -927,9 +973,6 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
|
|
927 |
}
|
928 |
unset( $instance['alternative'] );
|
929 |
}
|
930 |
-
|
931 |
-
//turn on hide_empty...
|
932 |
-
$instance['hide_empty'] = 1;
|
933 |
}
|
934 |
|
935 |
return $ok ? $instance : false;
|
@@ -1042,7 +1085,6 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
|
|
1042 |
/**
|
1043 |
* shortcode processing for [custom_menu_wizard option="" option="" ...] (as of v2.1.0)
|
1044 |
* see wp-includes/widgets.php for the_widget() code
|
1045 |
-
* Note that hide_empty is set to ON and can not be overridden!
|
1046 |
*
|
1047 |
* default (ie. no options) is:
|
1048 |
* - show all
|
@@ -1245,8 +1287,6 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
|
|
1245 |
}
|
1246 |
}
|
1247 |
$instance['widget_class'] = '';
|
1248 |
-
//turn on hide_empty...
|
1249 |
-
$instance['hide_empty'] = 1;
|
1250 |
}
|
1251 |
|
1252 |
if( $ok ){
|
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.3.0
|
7 |
* Author: Roger Barrett
|
8 |
* Author URI: http://www.wizzud.com/
|
9 |
* License: GPL2+
|
11 |
*/
|
12 |
defined( 'ABSPATH' ) or exit();
|
13 |
/*
|
14 |
+
* v3.3.0 change log
|
15 |
+
* - fixed bug : determination of current item failed when a "current page" item had itself as an ancestor
|
16 |
+
* - change : minimum WP version is now 3.9 (because require .dashicons-before)
|
17 |
+
* - change : removed the hide_empty option (only relevant pre WP3.6) entirely
|
18 |
+
* - change : dumped jQuery UI's Smoothness theme for WordPress's own CSS, to work around styling issues with WP4.5
|
19 |
+
* - change : localized all text used by assist, to reduce byte footprint of the widget
|
20 |
+
* - tweak : squidged the widget form a bit, to reduce byte footprint of the widget
|
21 |
+
* - add : in customizer, if there are no menus, link to the customizer's menus panel
|
22 |
+
* - add : opt in to customizer selective refresh for widgets (WP4.5)
|
23 |
+
* - change : remove support for Widget Customizer plugin (part of core from WP3.9)
|
24 |
+
* - bugfix : correction to regexps that sanitize the alternative
|
25 |
+
* - bugfix : corrected some problems with the assist dialog's auto-sizing, particularly after dragging
|
26 |
+
*
|
27 |
* v3.2.6 change log
|
28 |
* - added cmw-current-item class to the menu item that CMW is using as 'current item'
|
29 |
*
|
199 |
//declare the main plugin class...
|
200 |
class Custom_Menu_Wizard_Plugin {
|
201 |
|
202 |
+
public static $version = '3.3.0';
|
203 |
public static $script_handle = 'custom-menu-wizard-plugin-script';
|
204 |
public static $widget_class = 'Custom_Menu_Wizard_Widget';
|
205 |
+
public static $localised_texts = 'Custom_Menu_Wizard_Texts';
|
206 |
protected static $instance;
|
207 |
|
208 |
/**
|
212 |
|
213 |
load_plugin_textdomain( basename( dirname( __FILE__ ) ), false, basename( dirname( __FILE__ ) ) . '/languages' );
|
214 |
|
215 |
+
//register widget, add shortcode(s)...
|
216 |
add_action( 'widgets_init', array( &$this, 'widget_and_shortcode' ) );
|
217 |
+
//register CMW script file...
|
218 |
add_action( 'admin_enqueue_scripts', array( &$this, 'register_scripts' ) );
|
219 |
+
//queue CMW CSS and script (only on widgets page)...
|
220 |
add_action( 'admin_print_styles-widgets.php', array( &$this, 'enqueue_styles' ) );
|
221 |
add_action( 'admin_print_scripts-widgets.php', array( &$this, 'enqueue_scripts' ) );
|
|
|
222 |
//add customizer support...
|
223 |
add_action( 'customize_controls_enqueue_scripts', array( &$this, 'enqueue_styles' ) );
|
224 |
add_action( 'customize_controls_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
|
225 |
+
//handle request to find CMW shortcode(s)...
|
226 |
+
add_action( 'wp_ajax_cmw-find-shortcodes', array( &$this, 'ajax_find_shortcodes' ) );
|
227 |
+
|
228 |
+
//add plugin-update message...
|
229 |
+
add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
|
230 |
//add doc link to plugin's action links...
|
231 |
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( &$this, 'plugin_actions' ), 10, 4 );
|
232 |
|
277 |
* hooked into admin_print_styles-widgets.php & customize_controls_enqueue_scripts actions : queues styles needed by the plugin
|
278 |
*/
|
279 |
public function enqueue_styles(){
|
280 |
+
|
281 |
+
//require WordPress' own dialog CSS, which ensures dashicons gets loaded as well...
|
282 |
+
wp_enqueue_style( 'custom-menu-wizard-plugin-styles', plugins_url( '/custom-menu-wizard.css', __FILE__ ), array('wp-jquery-ui-dialog'), self::$version );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
|
284 |
} //end enqueue_styles()
|
285 |
|
302 |
$min = defined( 'WP_DEBUG' ) && WP_DEBUG ? '' : '.min';
|
303 |
wp_register_script( self::$script_handle, plugins_url( "/custom-menu-wizard$min.js", __FILE__ ), array('jquery-ui-dialog'), self::$version, true );
|
304 |
|
305 |
+
//translation strings for the assist...
|
306 |
+
wp_localize_script(
|
307 |
+
self::$script_handle,
|
308 |
+
self::$localised_texts,
|
309 |
+
array(
|
310 |
+
'version' => self::$version,
|
311 |
+
'prompt' => __('Click an item to toggle "Current Menu Item"', 'custom-menu-wizard'),
|
312 |
+
'output' => __('Basic Output', 'custom-menu-wizard'),
|
313 |
+
'fallback' => __('Fallback invoked', 'custom-menu-wizard'),
|
314 |
+
'setcurrent' => __('No Current Item!', 'custom-menu-wizard'),
|
315 |
+
'shortcodes' => __('Find posts/pages containing a CMW shortcode', 'custom-menu-wizard'),
|
316 |
+
'untitled' => __('untitled', 'custom-menu-wizard'),
|
317 |
+
'fixed' => __('fixed', 'custom-menu-wizard'),
|
318 |
+
//select option/optgroup texts...
|
319 |
+
'children' => __('children', 'custom-menu-wizard'),
|
320 |
+
'parent' => __('parent', 'custom-menu-wizard'),
|
321 |
+
'level_n' => __('level %d', 'custom-menu-wizard'), //eg. "level 2"
|
322 |
+
'n_levels' => __('%d levels', 'custom-menu-wizard'), //eg. "2 levels" or "-2 levels"
|
323 |
+
'to_level_n' => __('to level %d', 'custom-menu-wizard'), //eg. "to level 2"
|
324 |
+
//not applicable to legacy version...
|
325 |
+
'inclusions' => __('Inclusions', 'custom-menu-wizard') . ' : 0',
|
326 |
+
'exclusions' => __('Exclusions', 'custom-menu-wizard') . ' : 0',
|
327 |
+
'alternative' => __('Alternative settings', 'custom-menu-wizard'),
|
328 |
+
'more' => __('more', 'custom-menu-wizard'),
|
329 |
+
'less' => __('less', 'custom-menu-wizard')
|
330 |
+
)
|
331 |
+
);
|
332 |
+
//NB : Custom_Menu_Wizard_Plugin->form() also localizes some script - as
|
333 |
+
// var Custom_Menu_Wizard_Plugin = ...
|
334 |
+
// - if a widget is being edited in accessibility mode.
|
335 |
+
|
336 |
} //end register_scripts()
|
337 |
|
338 |
/**
|
543 |
$alt = trim( preg_replace( array( '/[\r\n\t]+/', '/\s\s+/' ), ' ', $alt[0] ), ' /' );
|
544 |
//remove leading 'cmwizard' tag...
|
545 |
$alt = preg_replace( '/^cmwizard\s/', '', $alt . ' ' );
|
546 |
+
//remove any occurrences of 'menu=whatever', 'widget=whatever' and 'alternative="whatever"' (optional double quotes), and trim spaces...
|
547 |
+
$alt = trim( preg_replace(
|
548 |
+
array('/\s(menu|widget)=[^\s]*/', '/\salternative=("[^"]*"|[^\s]*)/' ),
|
549 |
+
' ',
|
550 |
+
' ' . $alt . ' '
|
551 |
+
)
|
552 |
+
);
|
553 |
|
554 |
return $alt;
|
555 |
|
569 |
* shortcode processing for [cmwizard option="" option="" ...] (as of v3.0.0)
|
570 |
*
|
571 |
* see wp-includes/widgets.php for the_widget() code
|
|
|
572 |
*
|
573 |
* differences from [custom_menu_wizard] shortcode (ie. v2.1.0)
|
574 |
* deprecated:
|
973 |
}
|
974 |
unset( $instance['alternative'] );
|
975 |
}
|
|
|
|
|
|
|
976 |
}
|
977 |
|
978 |
return $ok ? $instance : false;
|
1085 |
/**
|
1086 |
* shortcode processing for [custom_menu_wizard option="" option="" ...] (as of v2.1.0)
|
1087 |
* see wp-includes/widgets.php for the_widget() code
|
|
|
1088 |
*
|
1089 |
* default (ie. no options) is:
|
1090 |
* - show all
|
1287 |
}
|
1288 |
}
|
1289 |
$instance['widget_class'] = '';
|
|
|
|
|
1290 |
}
|
1291 |
|
1292 |
if( $ok ){
|
custom-menu-wizard.png
DELETED
Binary file
|
doc/cmw-doc.html
CHANGED
@@ -4,13 +4,12 @@
|
|
4 |
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1">
|
6 |
<title>Custom Menu Wizard WordPress Plugin, Documentation</title>
|
7 |
-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.
|
8 |
<!--[if lt IE 9]>
|
9 |
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
10 |
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
11 |
<![endif]-->
|
12 |
-
<script src="https://
|
13 |
-
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
|
14 |
<style type="text/css">
|
15 |
.gototop, .gotoprev {
|
16 |
display: inline-block;
|
@@ -115,11 +114,11 @@ div > ul > li > ul, div > ol > li > ul {
|
|
115 |
<p>
|
116 |
<strong>Tags:</strong> menu, widget, navigation, custom menu, partial menu, current item, current page, menu level, menu branch, menu shortcode, menu widget, advanced, enhanced</p>
|
117 |
<p>
|
118 |
-
<strong>Requires at least:</strong> 3.
|
119 |
<p>
|
120 |
-
<strong>Tested up to:</strong> 4.
|
121 |
<p>
|
122 |
-
<strong>Stable tag:</strong> 3.
|
123 |
<p>
|
124 |
<strong>License:</strong> GPLv2 or Later </p>
|
125 |
|
@@ -135,6 +134,7 @@ div > ul > li > ul, div > ol > li > ul {
|
|
135 |
<li role="presentation"><a href="#Widget-Options" aria-controls="Widget-Options" role="tab" data-toggle="pill">Widget Options</a></li>
|
136 |
<li role="presentation"><a href="#Shortcode-Attributes" aria-controls="Shortcode-Attributes" role="tab" data-toggle="pill">Shortcode Attributes</a></li>
|
137 |
<li role="presentation"><a href="#FAQs" aria-controls="FAQs" role="tab" data-toggle="pill">FAQs</a></li>
|
|
|
138 |
<li role="presentation"><a href="#Changelog" aria-controls="Changelog" role="tab" data-toggle="pill">Changelog</a></li>
|
139 |
</ul>
|
140 |
</nav>
|
@@ -273,67 +273,65 @@ under <a href="#Widget-Options">Widget Options</a>.</p> </div>
|
|
273 |
<div role="tabpanel" class="tab-pane fade" id="Widget-Options">
|
274 |
<h2>Widget Options</h2>
|
275 |
<div class="row"><div class="col-md-4 col-md-push-8 col-lg-3 col-lg-push-9"><div class="tabpane-index panel panel-default"><div class="panel-body">
|
276 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><a href="#Widget-Options" data-scroll="#woption-
|
277 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><a href="#Widget-Options" data-scroll="#woption-
|
278 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><a href="#Widget-Options" data-scroll="#woption-
|
279 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><br class="hidden-md hidden-lg"/><strong>Filters Section</strong><span class="hidden-md hidden-lg"> :</span></span>
|
280 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Primary Filter</em><span class="hidden-md hidden-lg">:</span></span>
|
281 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
282 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
283 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
284 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Secondary Filter</em><span class="hidden-md hidden-lg">:</span></span>
|
285 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
286 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
287 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
288 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
289 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
290 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
291 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Inclusions</em><span class="hidden-md hidden-lg">:</span></span>
|
292 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
293 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
294 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
295 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
296 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Exclusions</em><span class="hidden-md hidden-lg">:</span></span>
|
297 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
298 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
299 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Qualifier</em><span class="hidden-md hidden-lg">:</span></span>
|
300 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
301 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><br class="hidden-md hidden-lg"/><strong>Fallbacks Section</strong><span class="hidden-md hidden-lg"> :</span></span>
|
302 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>If Current Item has no children</em><span class="hidden-md hidden-lg">:</span></span>
|
303 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
304 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
305 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
306 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>If no Current Item can be found</em><span class="hidden-md hidden-lg">:</span></span>
|
307 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
308 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>If more than 1 possible Current Item</em><span class="hidden-md hidden-lg">:</span></span>
|
309 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
310 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><br class="hidden-md hidden-lg"/><strong>Output Section</strong><span class="hidden-md hidden-lg"> :</span></span>
|
311 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
312 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
313 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Set Title from</em><span class="hidden-md hidden-lg">:</span></span>
|
314 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
315 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
316 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
317 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Change UL to OL</em><span class="hidden-md hidden-lg">:</span></span>
|
318 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
319 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
320 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Pre WordPress 3.6</em><span class="hidden-md hidden-lg">:</span></span>
|
321 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-43-Hide-Widget-if-Empty">Hide Widget if Empty</a></span>
|
322 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><br class="hidden-md hidden-lg"/><strong>Container Section</strong><span class="hidden-md hidden-lg"> :</span></span>
|
323 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
324 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
325 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
326 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><br class="hidden-md hidden-lg"/><strong>Classes Section</strong><span class="hidden-md hidden-lg"> :</span></span>
|
327 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
328 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
329 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><br class="hidden-md hidden-lg"/><strong>Links Section</strong><span class="hidden-md hidden-lg"> :</span></span>
|
330 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
331 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
332 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
333 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
334 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><br class="hidden-md hidden-lg"/><strong>Alternative Section</strong><span class="hidden-md hidden-lg"> :</span></span>
|
335 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
336 |
-
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-
|
337 |
</div></div></div>
|
338 |
<div class="col-md-8 col-md-pull-4 col-lg-9 col-lg-pull-3">
|
339 |
<p>There are quite a few options, which makes the widget settings box very long. I have therefore grouped most of the options into
|
@@ -345,16 +343,16 @@ under <a href="#Shortcode-Attributes">Shortcode Attributes</a>.</p>
|
|
345 |
<p><em><strong>Always Visible</strong></em></p>
|
346 |
|
347 |
<ul>
|
348 |
-
<li><p><strong id="woption-
|
349 |
|
350 |
<p>Set the title for your widget.</p></li>
|
351 |
-
<li><p><strong id="woption-
|
352 |
|
353 |
<p>Prevents the entered <code>Title</code> being displayed in the front-end widget output.</p>
|
354 |
|
355 |
<p>In the Widgets admin page, I find it useful to still be able to see the <code>Title</code> in the sidebar when the widget is closed, but I
|
356 |
don't necessarily want that <code>Title</code> to actually be output when the widget is displayed at the front-end. Hence this checkbox.</p></li>
|
357 |
-
<li><p><strong id="woption-
|
358 |
|
359 |
<p>Choose the appropriate menu from the dropdown list of Custom Menus currently defined in your WordPress application. The
|
360 |
first one available (alphabetically) is already selected for you by default.</p></li>
|
@@ -365,19 +363,19 @@ first one available (alphabetically) is already selected for you by default.</p>
|
|
365 |
<p><strong><em id="woption-1-Primary-Filter">Primary Filter</em></strong></p>
|
366 |
|
367 |
<ul>
|
368 |
-
<li><p><strong id="woption-
|
369 |
|
370 |
<p>Filters by level within the selected menu, starting at the level selected here. This is the default setting
|
371 |
for a new widget instance, which, if left alone and with all other options at their default, will show the entire selected menu.</p>
|
372 |
|
373 |
<p>Example : If you wanted to show all the options that were at level 3 or below, you could check this radio and set the select to "3".</p></li>
|
374 |
-
<li><p><strong id="woption-
|
375 |
|
376 |
<p>Filters by branch, with the head item of the branch being selected from the dropdown. The dropdown presents all the
|
377 |
items from the selected menu, plus a "Current Item" option (the default). Selecting "Current Item" means that the head item of the
|
378 |
branch is the current menu item (as indicated by WordPress), provided, of course, that the current menu item actually corresponds to
|
379 |
a menu item from the currently selected menu!</p></li>
|
380 |
-
<li><p><strong id="woption-
|
381 |
|
382 |
<p>Filters by the menu items that you specifically pick (by menu item id, as a comma-separated list). The simplest way
|
383 |
to get your list of ids is to use the "assist", and [un]check the green tick box at the right hand side of each depicted menu item that
|
@@ -396,7 +394,7 @@ descendants.</p></li>
|
|
396 |
<p><strong><em id="woption-2-Secondary-Filter">Secondary Filter</em></strong> <em>(not applicable to an <code>Items</code> filter)</em></p>
|
397 |
|
398 |
<ul>
|
399 |
-
<li><p><strong id="woption-
|
400 |
|
401 |
<p>This is only applicable to a <code>Branch</code> filter and it allows you to shift the starting point of your output within the confines
|
402 |
of the selected branch. By default it is set to the selected branch item itself, but it can be changed to a relative of the branch item (eg.
|
@@ -405,11 +403,11 @@ level item for the branch, or one level below the branch's root item, etc).</p>
|
|
405 |
|
406 |
<p>Example : If you wanted the entire "current" branch then, with <code>Branch</code> set to "Current Item", you might set <code>Starting at</code> to "1 (root)".
|
407 |
Alternatively, if you wanted the children of the current menu item then <code>Starting at</code> could be set to "+1 (children)".</p></li>
|
408 |
-
<li><p><strong id="woption-
|
409 |
|
410 |
<p>This is the default filter mechanism whereby, if <code>Starting at</code> can only result in a single item (ie. it is the branch item itself, or
|
411 |
an ancestor thereof) then only that item and its descendants are considered for filtering.</p></li>
|
412 |
-
<li><p><strong id="woption-
|
413 |
|
414 |
<p>Changes the default filter mechanism such that if <code>Starting at</code> results in the selection of the branch item or one of its ancestors,
|
415 |
then all siblings of that resultant item are also included in the secondary filtering process.</p>
|
@@ -420,10 +418,10 @@ to Joe - then the secondary filter would normally only consider Joe and its desc
|
|
420 |
|
421 |
<p>Note that there is one exception, and that is that if <code>Starting at</code> results in a root-level item, then <code>Allow all Root Items</code> must
|
422 |
be enabled in order to allow the other sibling root items to be added into the filter process.</p></li>
|
423 |
-
<li><p><strong id="woption-
|
424 |
|
425 |
<p>In the right conditions - see <code>Level</code> above - this allows sibling root items to be considered for secondary filtering.</p></li>
|
426 |
-
<li><p><strong id="woption-
|
427 |
|
428 |
<p>This the number of levels of the menu structure that will be considered for inclusion in the final output (in complete
|
429 |
ignorance of any subsequent Inclusions or Exclusions).</p>
|
@@ -432,7 +430,7 @@ ignorance of any subsequent Inclusions or Exclusions).</p>
|
|
432 |
how that starting level is determined (see <code>Starting at</code> and <code>Relative to Current Item</code> options). So if you ask
|
433 |
for a Depth of 1 level, you get just the starting level; if you ask for a Depth of 2, you get the starting level and
|
434 |
the one below it.</p></li>
|
435 |
-
<li><p><strong id="woption-
|
436 |
|
437 |
<p>By default, <code>For Depth</code> (above) is relative to the first item found, but this may be overridden to be relative to the
|
438 |
current menu item <strong><em>if</em></strong> <code>For Depth</code> is not unlimited <strong>and</strong> the current menu item can found within the selected menu.
|
@@ -451,21 +449,21 @@ Depth.</p></li>
|
|
451 |
or below the <code>Starting at</code> level, and do not include any items that would break the depth limit set in the Secondary Filter options.</p>
|
452 |
|
453 |
<ul>
|
454 |
-
<li><p><strong id="woption-
|
455 |
|
456 |
<p>Include any ancestors (parent, grandparent, etc) of the items selected as the <code>Branch</code> filter.
|
457 |
Ancestors can be set to go up to an absolute level, or to go up a certain number of levels relative to the <code>Branch</code> filter item.</p></li>
|
458 |
-
<li><p><strong id="woption-
|
459 |
|
460 |
<p>In conjunction with <code>Branch Ancestors</code>, also include all siblings of those ancestors.
|
461 |
As with Ancestors, their siblings can be set to go up to an absolute level, or to go up a certain number of levels relative
|
462 |
to the <code>Branch</code> filter item. Note that while it is possibe to set a larger range for siblings than ancestors, the final output
|
463 |
is limited by <code>Branch Ancestors</code> setting.</p></li>
|
464 |
-
<li><p><strong id="woption-
|
465 |
|
466 |
<p>Include any siblings of the item selected as the <code>Branch</code> filter (ie. any items at the same level and within
|
467 |
the same branch as the <code>Branch</code> item).</p></li>
|
468 |
-
<li><p><strong id="woption-
|
469 |
|
470 |
<p>This allows an entire level of items to be included, optionally also including all levels either above or below it.
|
471 |
This replaces the <code>All Root Items</code> checkbox (pre v3.0.4), which only allowed for the inclusion of the root level items.</p></li>
|
@@ -474,7 +472,7 @@ This replaces the <code>All Root Items</code> checkbox (pre v3.0.4), which only
|
|
474 |
<p><strong><em id="woption-4-Exclusions">Exclusions</em></strong></p>
|
475 |
|
476 |
<ul>
|
477 |
-
<li><p><strong id="woption-
|
478 |
|
479 |
<p>This is a comma-separated list of the ids of menu items that you do <em>not</em> want to appear in the final output.
|
480 |
The simplest way to get your list of ids is to use the "assist", and [un]check
|
@@ -488,7 +486,7 @@ set <code>Branch</code> to "A", and <code>Exclusions</code> to the id of the "AB
|
|
488 |
<p>Example : If you have a menu with 4 root items - "A", "B", "C" & "D" - and you wanted to show all items, with descendants, for all bar
|
489 |
the "C" branch, then you could set <code>Level</code> to "1 (root)" and <code>Exclusions</code> to, say, "12+", where "12" is the menu item id for "C" and
|
490 |
the "+" indicates that all the descendants of "C" should also be excluded.</p></li>
|
491 |
-
<li><p><strong id="woption-
|
492 |
|
493 |
<p>This allows an entire level of items to be excluded, optionally also excluding all levels either above or below it.</p></li>
|
494 |
</ul>
|
@@ -496,7 +494,7 @@ the "+" indicates that all the descendants of "C" should also be excluded.</p></
|
|
496 |
<p><strong><em id="woption-5-Qualifier">Qualifier</em></strong></p>
|
497 |
|
498 |
<ul>
|
499 |
-
<li><p><strong id="woption-
|
500 |
|
501 |
<p>This allows you to specify that there only be any output shown when/if the current menu item is one of the menu items selected
|
502 |
for output at a particular stage in the filter processing.</p>
|
@@ -524,7 +522,7 @@ and would normally include some of the current item's descendants
|
|
524 |
The fallback allows for the occasion when the current menu item <em>does not have</em> any immediate children.</p>
|
525 |
|
526 |
<ul>
|
527 |
-
<li><p><strong id="woption-
|
528 |
|
529 |
<p>Enable the fallback by selecting one of</p>
|
530 |
|
@@ -533,7 +531,7 @@ The fallback allows for the occasion when the current menu item <em>does not hav
|
|
533 |
<li><em>Start at : the Current Item</em> : overrides the <code>Starting at</code> option to be the Current Item</li>
|
534 |
<li><em>No output!</em> : self-explanatory</li>
|
535 |
</ul></li>
|
536 |
-
<li><p><strong id="woption-
|
537 |
|
538 |
<p>This will add in the siblings of the item selected above (excluding the "No output!" setting!).</p>
|
539 |
|
@@ -541,7 +539,7 @@ The fallback allows for the occasion when the current menu item <em>does not hav
|
|
541 |
set, then all the item's siblings <em>and their descendants</em> will automatically be included, and [un]setting this option will have no effect.
|
542 |
Also note that if the fallback results in a root-level item being selected as the new <code>Starting at</code> item, then the inclusion of siblings
|
543 |
outside the current branch depends on the setting of the <code>Allow all Root Items</code> checkbox.</p></li>
|
544 |
-
<li><p><strong id="woption-
|
545 |
|
546 |
<p>Override the current <code>For Depth</code> setting. Note that any depth value set here will be relative to the current item, regardless
|
547 |
of the current setting of <code>...Relative to</code>!</p>
|
@@ -555,7 +553,7 @@ fallback option to "1"? Or maybe A, B, C, and C's immediate children, by setting
|
|
555 |
<p><strong><em id="woption-7-If-no-Current-Item-can-be-found">If no Current Item can be found</em></strong></p>
|
556 |
|
557 |
<ul>
|
558 |
-
<li><p><strong id="woption-
|
559 |
|
560 |
<p>This gets applied right at the start of processing, when determining
|
561 |
which of the menu items (if any) should be regarded as the unique "Current Item" by this widget.
|
@@ -572,7 +570,7 @@ and set (one of) the found "parent" item(s) as the Current Item.</p></li>
|
|
572 |
<p><strong><em id="woption-8-If-more-than-1-possible-Current-Item">If more than 1 possible Current Item</em></strong></p>
|
573 |
|
574 |
<ul>
|
575 |
-
<li><p><strong id="woption-
|
576 |
|
577 |
<p>Occasionally it is possible for CMW to have more than one possible candidate for Current Item. Since there can only be one
|
578 |
Current Item, CMW picks the <em>first one</em> encountered. However, this may cause a problem where, for example, a root level item <strong>and</strong>
|
@@ -589,10 +587,10 @@ impossible for other configurations to also be affected.</p></li>
|
|
589 |
</ul>
|
590 |
<h3 id='Output-Section'>Output Section</h3>
|
591 |
<ul>
|
592 |
-
<li><p><strong id="woption-
|
593 |
|
594 |
<p>Output in the standard nested list format. The alternative is <code>Flat</code>.</p></li>
|
595 |
-
<li><p><strong id="woption-
|
596 |
|
597 |
<p>Output in a single list format, ignoring any parent-child relationship other than to maintain the same physical order as would be
|
598 |
presented in a <code>Hierarchical</code> output (which is the alternative and default).</p></li>
|
@@ -610,15 +608,15 @@ Also, an absolute setting - such as <code>Branch Item</code> "level 4" - will bo
|
|
610 |
if it's at/above the absolute level specified.</p>
|
611 |
|
612 |
<ul>
|
613 |
-
<li><p><strong id="woption-
|
614 |
|
615 |
<p>Sets <code>Title</code> from the current menu item (if current menu item is in the selected menu), or an ancestor
|
616 |
of that item, either at an absolute or relative level.</p></li>
|
617 |
-
<li><p><strong id="woption-
|
618 |
|
619 |
<p>Only applicable to a <code>Branch</code> filter, and sets <code>Title</code> from the <code>Branch</code> item, or an ancestor
|
620 |
of that item, either at an absolute or relative level.</p></li>
|
621 |
-
<li><p><strong id="woption-
|
622 |
|
623 |
<p>If the widget <code>Title</code> does actually get set using one of the options above, then this will
|
624 |
put an anchor around the title, using the information from the menu item that supplies the title.</p></li>
|
@@ -630,60 +628,48 @@ put an anchor around the title, using the information from the menu item that su
|
|
630 |
swap the ULs out for OLs (ordered lists).</p>
|
631 |
|
632 |
<ul>
|
633 |
-
<li><p><strong id="woption-
|
634 |
|
635 |
<p>Swap the outermost UL for an OL.</p></li>
|
636 |
-
<li><p><strong id="woption-
|
637 |
|
638 |
<p>Swap any nested (ie. not the outermost) ULs for an OLs.</p></li>
|
639 |
</ul>
|
640 |
-
|
641 |
-
<p><strong><em id="woption-11-Pre-WordPress-3.6">Pre WordPress 3.6</em></strong></p>
|
642 |
-
|
643 |
-
<p>Please note that as of WordPress v3.6, the <code>Hide Widget if Empty</code> option becomes superfluous and will <strong>not</strong>
|
644 |
-
be presented (the wp_nav_menu() function has been modified to automatically suppress all HTML output if there
|
645 |
-
are no items to be displayed).</p>
|
646 |
-
|
647 |
-
<ul>
|
648 |
-
<li><p><strong id="woption-43-Hide-Widget-if-Empty">Hide Widget if Empty</strong> <em>(checkbox)</em></p>
|
649 |
-
|
650 |
-
<p>If checked, the widget will not output <em>any</em> HTML unless it finds at least one menu item that matches the Filter settings.</p></li>
|
651 |
-
</ul>
|
652 |
<h3 id='Container-Section'>Container Section</h3>
|
653 |
<ul>
|
654 |
-
<li><p><strong id="woption-
|
655 |
|
656 |
<p>The menu list is usually wrapped in a "container" element, and this is the tag for that element.
|
657 |
You may change it for another tag, or you may clear it out and the container will be completely removed. Please note that
|
658 |
WordPress is set by default to only accept "div" or "nav", but that could be changed or extended by any theme or plugin.</p></li>
|
659 |
-
<li><p><strong id="woption-
|
660 |
|
661 |
<p>This allows you to specify your own id (which should be unique) for the container.</p></li>
|
662 |
-
<li><p><strong id="woption-
|
663 |
|
664 |
<p>This allows you to add your own class to the container element.</p></li>
|
665 |
</ul>
|
666 |
<h3 id='Classes-Section'>Classes Section</h3>
|
667 |
<ul>
|
668 |
-
<li><p><strong id="woption-
|
669 |
|
670 |
<p>This is the class that will be applied to the list element that holds the entire menu.</p></li>
|
671 |
-
<li><p><strong id="woption-
|
672 |
|
673 |
<p>This allows you to add your own class to the outermost element of the widget, the one that wraps the entire widget output.</p></li>
|
674 |
</ul>
|
675 |
<h3 id='Links-Section'>Links Section</h3>
|
676 |
<ul>
|
677 |
-
<li><p><strong id="woption-
|
678 |
|
679 |
<p>Text or HTML that will be placed immediately before each menu item's link.</p></li>
|
680 |
-
<li><p><strong id="woption-
|
681 |
|
682 |
<p>Text or HTML that will be placed immediately after each menu item's link.</p></li>
|
683 |
-
<li><p><strong id="woption-
|
684 |
|
685 |
<p>Text or HTML that will be placed immediately before each menu item's link text.</p></li>
|
686 |
-
<li><p><strong id="woption-
|
687 |
|
688 |
<p>Text or HTML that will be placed immediately after each menu item's link text.</p></li>
|
689 |
</ul>
|
@@ -694,12 +680,12 @@ of the menu : previously this was not possible solely with CMW, but now you can
|
|
694 |
scenario, and add an Alternative setting for when no Current Item can be determined.</p>
|
695 |
|
696 |
<ul>
|
697 |
-
<li><p><strong id="woption-
|
698 |
|
699 |
<p>Select the appropriate condition for when your Alternative configuration should be used, and also the stage within the
|
700 |
Filter processing when this condition should be tested for (similar to the Qualifier, <code>Current Item is in</code>). You need
|
701 |
values in both selects for the Alternative to be considered.</p></li>
|
702 |
-
<li><p><strong id="woption-
|
703 |
|
704 |
<p>This should contain a CMW-generated shortcode equivalent of the configuration that you want to switch to. Please note that leaving
|
705 |
this empty will <strong>not</strong> prevent the Alternative kicking in if the conditions are set and met! An empty <code>switch to</code> will merely default
|
@@ -785,6 +771,8 @@ adding an <code>orphaned=1</code> attribute.</p>
|
|
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 |
|
790 |
<p><em>string</em> : The output's <code>Title</code>, which may be overridden by <strong>title_from</strong>. Note that there is no shortcode equivalent of the widget's <code>Hide</code> option for the title.</p>
|
@@ -1283,7 +1271,53 @@ specific dynamic items, use a parent item that exists in the menu instead. If yo
|
|
1283 |
should be no problem.</p>
|
1284 |
|
1285 |
|
1286 |
-
</div></div></div><div class="panel panel-info"><a class="panel-heading show" role="tab" id="faq-13-heading" data-toggle="collapse" href="#faq-13" aria-expanded="false" aria-controls="faq-13"><h4 class="panel-title"><span class="glyphicon glyphicon-triangle-bottom pull-right"></span><span class="glyphicon glyphicon-triangle-top pull-right"></span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1287 |
|
1288 |
|
1289 |
<p>There is a button on the widget's "assist" - <code>[...]</code> - that will provide a list of posts/pages whose content, or meta data (custom fields),
|
@@ -1296,15 +1330,45 @@ the "assist" (for some unknown reason). You may optionally provide a title attri
|
|
1296 |
Note that output from this shortcode extension is restricted to users with edit_pages capability.</p>
|
1297 |
|
1298 |
|
1299 |
-
</div></div></div><div class="panel panel-info"><a class="panel-heading show" role="tab" id="faq-
|
1300 |
|
1301 |
|
1302 |
<p>In Version 3, Yes. However, I highly recommend that you upgrade your widgets & shortcodes to the latest versions,
|
1303 |
because Version 2 will <strong>not</strong> be supported beyond Version 3.</p>
|
1304 |
</div></div></div></div> </div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1305 |
<div role="tabpanel" class="tab-pane fade" id="Changelog">
|
1306 |
<h2>Changelog</h2>
|
1307 |
-
<h4>3.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1308 |
|
1309 |
<ul>
|
1310 |
<li>addition : add cmw-current-item class to the menu item that CMW is using as 'current item'</li>
|
@@ -1573,6 +1637,8 @@ because Version 2 will <strong>not</strong> be supported beyond Version 3.</p>
|
|
1573 |
<div class="gotoprev"><a class='btn btn-warning' href='#Description'><span class="glyphicon glyphicon-chevron-left"></span><span class="sr-only">return to previous tab and location</span></a></div>
|
1574 |
<div class="gototop" data-spy="affix" data-offset-top="100"><a class='btn btn-info' href='#Top'><span class="glyphicon glyphicon-chevron-up"></span><span class="sr-only">go to top of page</span></a></div>
|
1575 |
|
|
|
|
|
1576 |
<script type="text/javascript">
|
1577 |
jQuery(function($){
|
1578 |
var scrollWin = function(to){
|
@@ -1679,6 +1745,7 @@ because Version 2 will <strong>not</strong> be supported beyond Version 3.</p>
|
|
1679 |
active.removeData('scroller');
|
1680 |
scrollWin(prevdata.scrollto);
|
1681 |
}
|
|
|
1682 |
});
|
1683 |
});
|
1684 |
</script>
|
4 |
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1">
|
6 |
<title>Custom Menu Wizard WordPress Plugin, Documentation</title>
|
7 |
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
|
8 |
<!--[if lt IE 9]>
|
9 |
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
10 |
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
11 |
<![endif]-->
|
12 |
+
<script src="https://code.jquery.com/jquery-1.12.3.min.js" integrity="sha256-aaODHAgvwQW1bFOGXMeX+pC4PZIPsvn2h1sArYOhgXQ=" crossorigin="anonymous"></script>
|
|
|
13 |
<style type="text/css">
|
14 |
.gototop, .gotoprev {
|
15 |
display: inline-block;
|
114 |
<p>
|
115 |
<strong>Tags:</strong> menu, widget, navigation, custom menu, partial menu, current item, current page, menu level, menu branch, menu shortcode, menu widget, advanced, enhanced</p>
|
116 |
<p>
|
117 |
+
<strong>Requires at least:</strong> 3.9</p>
|
118 |
<p>
|
119 |
+
<strong>Tested up to:</strong> 4.5</p>
|
120 |
<p>
|
121 |
+
<strong>Stable tag:</strong> 3.3.0</p>
|
122 |
<p>
|
123 |
<strong>License:</strong> GPLv2 or Later </p>
|
124 |
|
134 |
<li role="presentation"><a href="#Widget-Options" aria-controls="Widget-Options" role="tab" data-toggle="pill">Widget Options</a></li>
|
135 |
<li role="presentation"><a href="#Shortcode-Attributes" aria-controls="Shortcode-Attributes" role="tab" data-toggle="pill">Shortcode Attributes</a></li>
|
136 |
<li role="presentation"><a href="#FAQs" aria-controls="FAQs" role="tab" data-toggle="pill">FAQs</a></li>
|
137 |
+
<li role="presentation"><a href="#Screenshots" aria-controls="Screenshots" role="tab" data-toggle="pill">Screenshots</a></li>
|
138 |
<li role="presentation"><a href="#Changelog" aria-controls="Changelog" role="tab" data-toggle="pill">Changelog</a></li>
|
139 |
</ul>
|
140 |
</nav>
|
273 |
<div role="tabpanel" class="tab-pane fade" id="Widget-Options">
|
274 |
<h2>Widget Options</h2>
|
275 |
<div class="row"><div class="col-md-4 col-md-push-8 col-lg-3 col-lg-push-9"><div class="tabpane-index panel panel-default"><div class="panel-body">
|
276 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><a href="#Widget-Options" data-scroll="#woption-11-Title">Title</a><span class="hidden-md hidden-lg"> ,</span></span>
|
277 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><a href="#Widget-Options" data-scroll="#woption-12-Hide">Hide</a><span class="hidden-md hidden-lg"> ,</span></span>
|
278 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><a href="#Widget-Options" data-scroll="#woption-13-Select-Menu">Select Menu</a></span>
|
279 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><br class="hidden-md hidden-lg"/><strong>Filters Section</strong><span class="hidden-md hidden-lg"> :</span></span>
|
280 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Primary Filter</em><span class="hidden-md hidden-lg">:</span></span>
|
281 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-14-Level">Level</a><span class="hidden-md hidden-lg"> ,</span></span>
|
282 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-15-Branch">Branch</a><span class="hidden-md hidden-lg"> ,</span></span>
|
283 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-16-Items">Items</a><span class="hidden-md hidden-lg"> ,</span></span>
|
284 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Secondary Filter</em><span class="hidden-md hidden-lg">:</span></span>
|
285 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-17-Starting-at">Starting at</a><span class="hidden-md hidden-lg"> ,</span></span>
|
286 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-18-Item-if-possible">Item, if possible</a><span class="hidden-md hidden-lg"> ,</span></span>
|
287 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-19-Level">Level</a><span class="hidden-md hidden-lg"> ,</span></span>
|
288 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-20-Allow-all-Root-Items">Allow all Root Items</a><span class="hidden-md hidden-lg"> ,</span></span>
|
289 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-21-For-Depth">For Depth</a><span class="hidden-md hidden-lg"> ,</span></span>
|
290 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-22-Relative-to-Current-Item">Relative to Current Item</a><span class="hidden-md hidden-lg"> ,</span></span>
|
291 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Inclusions</em><span class="hidden-md hidden-lg">:</span></span>
|
292 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-23-Branch-Ancestors">Branch Ancestors</a><span class="hidden-md hidden-lg"> ,</span></span>
|
293 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-24--with-Siblings">... with Siblings</a><span class="hidden-md hidden-lg"> ,</span></span>
|
294 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-25-Branch-Siblings">Branch Siblings</a><span class="hidden-md hidden-lg"> ,</span></span>
|
295 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-26-Level">Level</a><span class="hidden-md hidden-lg"> ,</span></span>
|
296 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Exclusions</em><span class="hidden-md hidden-lg">:</span></span>
|
297 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-27-Item-Ids">Item Ids</a><span class="hidden-md hidden-lg"> ,</span></span>
|
298 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-28-Level">Level</a><span class="hidden-md hidden-lg"> ,</span></span>
|
299 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Qualifier</em><span class="hidden-md hidden-lg">:</span></span>
|
300 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-29-Current-Item-is-in">Current Item is in</a></span>
|
301 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><br class="hidden-md hidden-lg"/><strong>Fallbacks Section</strong><span class="hidden-md hidden-lg"> :</span></span>
|
302 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>If Current Item has no children</em><span class="hidden-md hidden-lg">:</span></span>
|
303 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-30-Unlabelled-Select">Unlabelled Select</a><span class="hidden-md hidden-lg"> ,</span></span>
|
304 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-31-and-Include-its-Siblings">...and Include its Siblings</a><span class="hidden-md hidden-lg"> ,</span></span>
|
305 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-32-For-Depth">For Depth</a><span class="hidden-md hidden-lg"> ,</span></span>
|
306 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>If no Current Item can be found</em><span class="hidden-md hidden-lg">:</span></span>
|
307 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-33-Try-items-marked-Parent-of-Current">Try items marked Parent of Current</a><span class="hidden-md hidden-lg"> ,</span></span>
|
308 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>If more than 1 possible Current Item</em><span class="hidden-md hidden-lg">:</span></span>
|
309 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-34-Use-the-last-one-found">Use the last one found</a></span>
|
310 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><br class="hidden-md hidden-lg"/><strong>Output Section</strong><span class="hidden-md hidden-lg"> :</span></span>
|
311 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-35-Hierarchical">Hierarchical</a><span class="hidden-md hidden-lg"> ,</span></span>
|
312 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-36-Flat">Flat</a><span class="hidden-md hidden-lg"> ,</span></span>
|
313 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Set Title from</em><span class="hidden-md hidden-lg">:</span></span>
|
314 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-37-Current-Item">Current Item</a><span class="hidden-md hidden-lg"> ,</span></span>
|
315 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-38-Branch-Item">Branch Item</a><span class="hidden-md hidden-lg"> ,</span></span>
|
316 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-39-Make-it-a-Link">Make it a Link</a><span class="hidden-md hidden-lg"> ,</span></span>
|
317 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><em>Change UL to OL</em><span class="hidden-md hidden-lg">:</span></span>
|
318 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-40-Top-Level">Top Level</a><span class="hidden-md hidden-lg"> ,</span></span>
|
319 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:1em;"></span><a href="#Widget-Options" data-scroll="#woption-41-Sub-Levels">Sub-Levels</a></span>
|
|
|
|
|
320 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><br class="hidden-md hidden-lg"/><strong>Container Section</strong><span class="hidden-md hidden-lg"> :</span></span>
|
321 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-42-Element">Element</a><span class="hidden-md hidden-lg"> ,</span></span>
|
322 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-43-Unique-ID">Unique ID</a><span class="hidden-md hidden-lg"> ,</span></span>
|
323 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-44-Class">Class</a></span>
|
324 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><br class="hidden-md hidden-lg"/><strong>Classes Section</strong><span class="hidden-md hidden-lg"> :</span></span>
|
325 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-45-Menu-Class">Menu Class</a><span class="hidden-md hidden-lg"> ,</span></span>
|
326 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-46-Widget-Class">Widget Class</a></span>
|
327 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><br class="hidden-md hidden-lg"/><strong>Links Section</strong><span class="hidden-md hidden-lg"> :</span></span>
|
328 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-47-Before-the-Link">Before the Link</a><span class="hidden-md hidden-lg"> ,</span></span>
|
329 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-48-After-the-Link">After the Link</a><span class="hidden-md hidden-lg"> ,</span></span>
|
330 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-49-Before-the-Link-Text">Before the Link Text</a><span class="hidden-md hidden-lg"> ,</span></span>
|
331 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-50-After-the-Link-Text">After the Link Text</a></span>
|
332 |
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><br class="hidden-md hidden-lg"/><strong>Alternative Section</strong><span class="hidden-md hidden-lg"> :</span></span>
|
333 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-51-On-condition">On condition</a><span class="hidden-md hidden-lg"> ,</span></span>
|
334 |
+
<span class="text-nowrap visible-xs-inline visible-sm-inline visible-md-block visible-lg-block"><span class="hidden-xs hidden-sm" style="margin-left:0.5em;"></span><a href="#Widget-Options" data-scroll="#woption-52-Then-switch-settings-to">Then switch settings to</a></span>
|
335 |
</div></div></div>
|
336 |
<div class="col-md-8 col-md-pull-4 col-lg-9 col-lg-pull-3">
|
337 |
<p>There are quite a few options, which makes the widget settings box very long. I have therefore grouped most of the options into
|
343 |
<p><em><strong>Always Visible</strong></em></p>
|
344 |
|
345 |
<ul>
|
346 |
+
<li><p><strong id="woption-11-Title">Title</strong> <em>(textbox)</em></p>
|
347 |
|
348 |
<p>Set the title for your widget.</p></li>
|
349 |
+
<li><p><strong id="woption-12-Hide">Hide</strong> <em>(checkbox)</em></p>
|
350 |
|
351 |
<p>Prevents the entered <code>Title</code> being displayed in the front-end widget output.</p>
|
352 |
|
353 |
<p>In the Widgets admin page, I find it useful to still be able to see the <code>Title</code> in the sidebar when the widget is closed, but I
|
354 |
don't necessarily want that <code>Title</code> to actually be output when the widget is displayed at the front-end. Hence this checkbox.</p></li>
|
355 |
+
<li><p><strong id="woption-13-Select-Menu">Select Menu</strong> <em>(select)</em></p>
|
356 |
|
357 |
<p>Choose the appropriate menu from the dropdown list of Custom Menus currently defined in your WordPress application. The
|
358 |
first one available (alphabetically) is already selected for you by default.</p></li>
|
363 |
<p><strong><em id="woption-1-Primary-Filter">Primary Filter</em></strong></p>
|
364 |
|
365 |
<ul>
|
366 |
+
<li><p><strong id="woption-14-Level">Level</strong> <em>(radio, default On, & select)</em></p>
|
367 |
|
368 |
<p>Filters by level within the selected menu, starting at the level selected here. This is the default setting
|
369 |
for a new widget instance, which, if left alone and with all other options at their default, will show the entire selected menu.</p>
|
370 |
|
371 |
<p>Example : If you wanted to show all the options that were at level 3 or below, you could check this radio and set the select to "3".</p></li>
|
372 |
+
<li><p><strong id="woption-15-Branch">Branch</strong> <em>(radio & select)</em></p>
|
373 |
|
374 |
<p>Filters by branch, with the head item of the branch being selected from the dropdown. The dropdown presents all the
|
375 |
items from the selected menu, plus a "Current Item" option (the default). Selecting "Current Item" means that the head item of the
|
376 |
branch is the current menu item (as indicated by WordPress), provided, of course, that the current menu item actually corresponds to
|
377 |
a menu item from the currently selected menu!</p></li>
|
378 |
+
<li><p><strong id="woption-16-Items">Items</strong> <em>(radio & textbox)</em></p>
|
379 |
|
380 |
<p>Filters by the menu items that you specifically pick (by menu item id, as a comma-separated list). The simplest way
|
381 |
to get your list of ids is to use the "assist", and [un]check the green tick box at the right hand side of each depicted menu item that
|
394 |
<p><strong><em id="woption-2-Secondary-Filter">Secondary Filter</em></strong> <em>(not applicable to an <code>Items</code> filter)</em></p>
|
395 |
|
396 |
<ul>
|
397 |
+
<li><p><strong id="woption-17-Starting-at">Starting at</strong> <em>(select)</em></p>
|
398 |
|
399 |
<p>This is only applicable to a <code>Branch</code> filter and it allows you to shift the starting point of your output within the confines
|
400 |
of the selected branch. By default it is set to the selected branch item itself, but it can be changed to a relative of the branch item (eg.
|
403 |
|
404 |
<p>Example : If you wanted the entire "current" branch then, with <code>Branch</code> set to "Current Item", you might set <code>Starting at</code> to "1 (root)".
|
405 |
Alternatively, if you wanted the children of the current menu item then <code>Starting at</code> could be set to "+1 (children)".</p></li>
|
406 |
+
<li><p><strong id="woption-18-Item-if-possible">Item, if possible</strong> <em>(radio, default On)</em></p>
|
407 |
|
408 |
<p>This is the default filter mechanism whereby, if <code>Starting at</code> can only result in a single item (ie. it is the branch item itself, or
|
409 |
an ancestor thereof) then only that item and its descendants are considered for filtering.</p></li>
|
410 |
+
<li><p><strong id="woption-19-Level">Level</strong> <em>(radio)</em></p>
|
411 |
|
412 |
<p>Changes the default filter mechanism such that if <code>Starting at</code> results in the selection of the branch item or one of its ancestors,
|
413 |
then all siblings of that resultant item are also included in the secondary filtering process.</p>
|
418 |
|
419 |
<p>Note that there is one exception, and that is that if <code>Starting at</code> results in a root-level item, then <code>Allow all Root Items</code> must
|
420 |
be enabled in order to allow the other sibling root items to be added into the filter process.</p></li>
|
421 |
+
<li><p><strong id="woption-20-Allow-all-Root-Items">Allow all Root Items</strong> <em>(checkbox)</em></p>
|
422 |
|
423 |
<p>In the right conditions - see <code>Level</code> above - this allows sibling root items to be considered for secondary filtering.</p></li>
|
424 |
+
<li><p><strong id="woption-21-For-Depth">For Depth</strong> <em>(select)</em></p>
|
425 |
|
426 |
<p>This the number of levels of the menu structure that will be considered for inclusion in the final output (in complete
|
427 |
ignorance of any subsequent Inclusions or Exclusions).</p>
|
430 |
how that starting level is determined (see <code>Starting at</code> and <code>Relative to Current Item</code> options). So if you ask
|
431 |
for a Depth of 1 level, you get just the starting level; if you ask for a Depth of 2, you get the starting level and
|
432 |
the one below it.</p></li>
|
433 |
+
<li><p><strong id="woption-22-Relative-to-Current-Item">Relative to Current Item</strong> <em>(checkbox)</em></p>
|
434 |
|
435 |
<p>By default, <code>For Depth</code> (above) is relative to the first item found, but this may be overridden to be relative to the
|
436 |
current menu item <strong><em>if</em></strong> <code>For Depth</code> is not unlimited <strong>and</strong> the current menu item can found within the selected menu.
|
449 |
or below the <code>Starting at</code> level, and do not include any items that would break the depth limit set in the Secondary Filter options.</p>
|
450 |
|
451 |
<ul>
|
452 |
+
<li><p><strong id="woption-23-Branch-Ancestors">Branch Ancestors</strong> <em>(select)</em></p>
|
453 |
|
454 |
<p>Include any ancestors (parent, grandparent, etc) of the items selected as the <code>Branch</code> filter.
|
455 |
Ancestors can be set to go up to an absolute level, or to go up a certain number of levels relative to the <code>Branch</code> filter item.</p></li>
|
456 |
+
<li><p><strong id="woption-24--with-Siblings">... with Siblings</strong> <em>(select)</em></p>
|
457 |
|
458 |
<p>In conjunction with <code>Branch Ancestors</code>, also include all siblings of those ancestors.
|
459 |
As with Ancestors, their siblings can be set to go up to an absolute level, or to go up a certain number of levels relative
|
460 |
to the <code>Branch</code> filter item. Note that while it is possibe to set a larger range for siblings than ancestors, the final output
|
461 |
is limited by <code>Branch Ancestors</code> setting.</p></li>
|
462 |
+
<li><p><strong id="woption-25-Branch-Siblings">Branch Siblings</strong> <em>(checkbox)</em></p>
|
463 |
|
464 |
<p>Include any siblings of the item selected as the <code>Branch</code> filter (ie. any items at the same level and within
|
465 |
the same branch as the <code>Branch</code> item).</p></li>
|
466 |
+
<li><p><strong id="woption-26-Level">Level</strong> <em>(select)</em></p>
|
467 |
|
468 |
<p>This allows an entire level of items to be included, optionally also including all levels either above or below it.
|
469 |
This replaces the <code>All Root Items</code> checkbox (pre v3.0.4), which only allowed for the inclusion of the root level items.</p></li>
|
472 |
<p><strong><em id="woption-4-Exclusions">Exclusions</em></strong></p>
|
473 |
|
474 |
<ul>
|
475 |
+
<li><p><strong id="woption-27-Item-Ids">Item Ids</strong> <em>(textbox)</em></p>
|
476 |
|
477 |
<p>This is a comma-separated list of the ids of menu items that you do <em>not</em> want to appear in the final output.
|
478 |
The simplest way to get your list of ids is to use the "assist", and [un]check
|
486 |
<p>Example : If you have a menu with 4 root items - "A", "B", "C" & "D" - and you wanted to show all items, with descendants, for all bar
|
487 |
the "C" branch, then you could set <code>Level</code> to "1 (root)" and <code>Exclusions</code> to, say, "12+", where "12" is the menu item id for "C" and
|
488 |
the "+" indicates that all the descendants of "C" should also be excluded.</p></li>
|
489 |
+
<li><p><strong id="woption-28-Level">Level</strong> <em>(select)</em></p>
|
490 |
|
491 |
<p>This allows an entire level of items to be excluded, optionally also excluding all levels either above or below it.</p></li>
|
492 |
</ul>
|
494 |
<p><strong><em id="woption-5-Qualifier">Qualifier</em></strong></p>
|
495 |
|
496 |
<ul>
|
497 |
+
<li><p><strong id="woption-29-Current-Item-is-in">Current Item is in</strong> <em>(select)</em></p>
|
498 |
|
499 |
<p>This allows you to specify that there only be any output shown when/if the current menu item is one of the menu items selected
|
500 |
for output at a particular stage in the filter processing.</p>
|
522 |
The fallback allows for the occasion when the current menu item <em>does not have</em> any immediate children.</p>
|
523 |
|
524 |
<ul>
|
525 |
+
<li><p><strong id="woption-30-Unlabelled-Select">Unlabelled Select</strong> <em>(select)</em></p>
|
526 |
|
527 |
<p>Enable the fallback by selecting one of</p>
|
528 |
|
531 |
<li><em>Start at : the Current Item</em> : overrides the <code>Starting at</code> option to be the Current Item</li>
|
532 |
<li><em>No output!</em> : self-explanatory</li>
|
533 |
</ul></li>
|
534 |
+
<li><p><strong id="woption-31-and-Include-its-Siblings">...and Include its Siblings</strong> <em>(checkbox)</em></p>
|
535 |
|
536 |
<p>This will add in the siblings of the item selected above (excluding the "No output!" setting!).</p>
|
537 |
|
539 |
set, then all the item's siblings <em>and their descendants</em> will automatically be included, and [un]setting this option will have no effect.
|
540 |
Also note that if the fallback results in a root-level item being selected as the new <code>Starting at</code> item, then the inclusion of siblings
|
541 |
outside the current branch depends on the setting of the <code>Allow all Root Items</code> checkbox.</p></li>
|
542 |
+
<li><p><strong id="woption-32-For-Depth">For Depth</strong> <em>(select)</em></p>
|
543 |
|
544 |
<p>Override the current <code>For Depth</code> setting. Note that any depth value set here will be relative to the current item, regardless
|
545 |
of the current setting of <code>...Relative to</code>!</p>
|
553 |
<p><strong><em id="woption-7-If-no-Current-Item-can-be-found">If no Current Item can be found</em></strong></p>
|
554 |
|
555 |
<ul>
|
556 |
+
<li><p><strong id="woption-33-Try-items-marked-Parent-of-Current">Try items marked Parent of Current</strong> <em>(checkbox)</em></p>
|
557 |
|
558 |
<p>This gets applied right at the start of processing, when determining
|
559 |
which of the menu items (if any) should be regarded as the unique "Current Item" by this widget.
|
570 |
<p><strong><em id="woption-8-If-more-than-1-possible-Current-Item">If more than 1 possible Current Item</em></strong></p>
|
571 |
|
572 |
<ul>
|
573 |
+
<li><p><strong id="woption-34-Use-the-last-one-found">Use the last one found</strong> <em>(checkbox)</em></p>
|
574 |
|
575 |
<p>Occasionally it is possible for CMW to have more than one possible candidate for Current Item. Since there can only be one
|
576 |
Current Item, CMW picks the <em>first one</em> encountered. However, this may cause a problem where, for example, a root level item <strong>and</strong>
|
587 |
</ul>
|
588 |
<h3 id='Output-Section'>Output Section</h3>
|
589 |
<ul>
|
590 |
+
<li><p><strong id="woption-35-Hierarchical">Hierarchical</strong> <em>(radio, default On)</em></p>
|
591 |
|
592 |
<p>Output in the standard nested list format. The alternative is <code>Flat</code>.</p></li>
|
593 |
+
<li><p><strong id="woption-36-Flat">Flat</strong> <em>(radio)</em></p>
|
594 |
|
595 |
<p>Output in a single list format, ignoring any parent-child relationship other than to maintain the same physical order as would be
|
596 |
presented in a <code>Hierarchical</code> output (which is the alternative and default).</p></li>
|
608 |
if it's at/above the absolute level specified.</p>
|
609 |
|
610 |
<ul>
|
611 |
+
<li><p><strong id="woption-37-Current-Item">Current Item</strong> <em>(select)</em></p>
|
612 |
|
613 |
<p>Sets <code>Title</code> from the current menu item (if current menu item is in the selected menu), or an ancestor
|
614 |
of that item, either at an absolute or relative level.</p></li>
|
615 |
+
<li><p><strong id="woption-38-Branch-Item">Branch Item</strong> *(select)</p>
|
616 |
|
617 |
<p>Only applicable to a <code>Branch</code> filter, and sets <code>Title</code> from the <code>Branch</code> item, or an ancestor
|
618 |
of that item, either at an absolute or relative level.</p></li>
|
619 |
+
<li><p><strong id="woption-39-Make-it-a-Link">Make it a Link</strong> <em>(checkbox)</em></p>
|
620 |
|
621 |
<p>If the widget <code>Title</code> does actually get set using one of the options above, then this will
|
622 |
put an anchor around the title, using the information from the menu item that supplies the title.</p></li>
|
628 |
swap the ULs out for OLs (ordered lists).</p>
|
629 |
|
630 |
<ul>
|
631 |
+
<li><p><strong id="woption-40-Top-Level">Top Level</strong> <em>(checkbox)</em></p>
|
632 |
|
633 |
<p>Swap the outermost UL for an OL.</p></li>
|
634 |
+
<li><p><strong id="woption-41-Sub-Levels">Sub-Levels</strong> <em>(checkbox)</em></p>
|
635 |
|
636 |
<p>Swap any nested (ie. not the outermost) ULs for an OLs.</p></li>
|
637 |
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
638 |
<h3 id='Container-Section'>Container Section</h3>
|
639 |
<ul>
|
640 |
+
<li><p><strong id="woption-42-Element">Element</strong> <em>(textbox, default "div")</em></p>
|
641 |
|
642 |
<p>The menu list is usually wrapped in a "container" element, and this is the tag for that element.
|
643 |
You may change it for another tag, or you may clear it out and the container will be completely removed. Please note that
|
644 |
WordPress is set by default to only accept "div" or "nav", but that could be changed or extended by any theme or plugin.</p></li>
|
645 |
+
<li><p><strong id="woption-43-Unique-ID">Unique ID</strong> <em>(textbox)</em></p>
|
646 |
|
647 |
<p>This allows you to specify your own id (which should be unique) for the container.</p></li>
|
648 |
+
<li><p><strong id="woption-44-Class">Class</strong> <em>(textbox)</em></p>
|
649 |
|
650 |
<p>This allows you to add your own class to the container element.</p></li>
|
651 |
</ul>
|
652 |
<h3 id='Classes-Section'>Classes Section</h3>
|
653 |
<ul>
|
654 |
+
<li><p><strong id="woption-45-Menu-Class">Menu Class</strong> <em>(textbox, default "menu-widget")</em></p>
|
655 |
|
656 |
<p>This is the class that will be applied to the list element that holds the entire menu.</p></li>
|
657 |
+
<li><p><strong id="woption-46-Widget-Class">Widget Class</strong> <em>(textbox)</em></p>
|
658 |
|
659 |
<p>This allows you to add your own class to the outermost element of the widget, the one that wraps the entire widget output.</p></li>
|
660 |
</ul>
|
661 |
<h3 id='Links-Section'>Links Section</h3>
|
662 |
<ul>
|
663 |
+
<li><p><strong id="woption-47-Before-the-Link">Before the Link</strong> <em>(textbox)</em></p>
|
664 |
|
665 |
<p>Text or HTML that will be placed immediately before each menu item's link.</p></li>
|
666 |
+
<li><p><strong id="woption-48-After-the-Link">After the Link</strong> <em>(textbox)</em></p>
|
667 |
|
668 |
<p>Text or HTML that will be placed immediately after each menu item's link.</p></li>
|
669 |
+
<li><p><strong id="woption-49-Before-the-Link-Text">Before the Link Text</strong> <em>(textbox)</em></p>
|
670 |
|
671 |
<p>Text or HTML that will be placed immediately before each menu item's link text.</p></li>
|
672 |
+
<li><p><strong id="woption-50-After-the-Link-Text">After the Link Text</strong> <em>(textbox)</em></p>
|
673 |
|
674 |
<p>Text or HTML that will be placed immediately after each menu item's link text.</p></li>
|
675 |
</ul>
|
680 |
scenario, and add an Alternative setting for when no Current Item can be determined.</p>
|
681 |
|
682 |
<ul>
|
683 |
+
<li><p><strong id="woption-51-On-condition">On condition</strong> <em>(2 selects)</em></p>
|
684 |
|
685 |
<p>Select the appropriate condition for when your Alternative configuration should be used, and also the stage within the
|
686 |
Filter processing when this condition should be tested for (similar to the Qualifier, <code>Current Item is in</code>). You need
|
687 |
values in both selects for the Alternative to be considered.</p></li>
|
688 |
+
<li><p><strong id="woption-52-Then-switch-settings-to">Then switch settings to</strong> <em>(textarea)</em></p>
|
689 |
|
690 |
<p>This should contain a CMW-generated shortcode equivalent of the configuration that you want to switch to. Please note that leaving
|
691 |
this empty will <strong>not</strong> prevent the Alternative kicking in if the conditions are set and met! An empty <code>switch to</code> will merely default
|
771 |
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
|
772 |
Inactive Widgets area). You can override the widget instance's settings by supplying any of the other standard shortcode attributes.</p>
|
773 |
|
774 |
+
<p>Note that you can't use this attribute as part of an Alternative setting (it is simply ignored).</p>
|
775 |
+
|
776 |
<h4 id="sattribute-title">title</h4>
|
777 |
|
778 |
<p><em>string</em> : The output's <code>Title</code>, which may be overridden by <strong>title_from</strong>. Note that there is no shortcode equivalent of the widget's <code>Hide</code> option for the title.</p>
|
1271 |
should be no problem.</p>
|
1272 |
|
1273 |
|
1274 |
+
</div></div></div><div class="panel panel-info"><a class="panel-heading show" role="tab" id="faq-13-heading" data-toggle="collapse" href="#faq-13" aria-expanded="false" aria-controls="faq-13"><h4 class="panel-title"><span class="glyphicon glyphicon-triangle-bottom pull-right"></span><span class="glyphicon glyphicon-triangle-top pull-right"></span>What classes does CMW automatically assign?</h4></a><div id="faq-13" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faq-13-heading"><div class="panel-body">
|
1275 |
+
|
1276 |
+
|
1277 |
+
<p>Every menu item :</p>
|
1278 |
+
|
1279 |
+
<ul>
|
1280 |
+
<li><code>cmw-level-N</code> : every menu item gets this class, with <code>N</code> being the hierarchical level of the item within the menu
|
1281 |
+
shown (starting at 1). Note that selecting the <em>flat</em> output option does <strong>not</strong> affect the hierarchical level of
|
1282 |
+
any item.</li>
|
1283 |
+
</ul>
|
1284 |
+
|
1285 |
+
<p>Certain menu items :</p>
|
1286 |
+
|
1287 |
+
<ul>
|
1288 |
+
<li><code>cmw-current-item</code> : assigned to the menu item that CMW has decided to use as the "current menu item".</li>
|
1289 |
+
<li><code>cmw-has-submenu</code> : assigned to any menu item that has child items in the output menu.</li>
|
1290 |
+
<li><code>cmw-menu-item-had-children</code> : assigned to any menu item that had child items in the original base
|
1291 |
+
menu, <em>regardless</em> of whether it still has child items in the final output menu.</li>
|
1292 |
+
<li><code>cmw-an-included-ancestor</code> : assigned to any menu item whose presence is solely due to a request to include ancestors.</li>
|
1293 |
+
<li><code>cmw-an-included-ancestor-sibling</code> : assigned to any menu item whose presence is solely due to a request to include
|
1294 |
+
the siblings of ancestors.</li>
|
1295 |
+
<li><code>cmw-an-included-sibling</code> : assigned to any menu item whose presence is solely due to a request to include branch
|
1296 |
+
item siblings.</li>
|
1297 |
+
<li><code>cmw-an-included-level</code> : assigned to any menu item whose presence is solely due to a request to include one or
|
1298 |
+
more levels.</li>
|
1299 |
+
</ul>
|
1300 |
+
|
1301 |
+
<p>The menu itself (the outermost list element) :</p>
|
1302 |
+
|
1303 |
+
<ul>
|
1304 |
+
<li><code>cmw-fellback-to-parent</code> : assigned to the menu when the fallback for <em>Current Item has no children</em> is set
|
1305 |
+
to <code>Start at : -1 (parent)</code>, and it has been invoked.</li>
|
1306 |
+
<li><code>cmw-fellback-to-current</code> : assigned to the menu when the fallback for <em>Current Item has no children</em> is set
|
1307 |
+
to <code>Start at : the Current Item</code>, and it has been invoked.</li>
|
1308 |
+
<li><code>cmw-invoked-alternative</code> : assigned to the menu when the output has been produced as a result of
|
1309 |
+
an <em>alternative</em> configuration being brought into play.</li>
|
1310 |
+
</ul>
|
1311 |
+
|
1312 |
+
<p>The menu wrapper :</p>
|
1313 |
+
|
1314 |
+
<ul>
|
1315 |
+
<li><code>shortcode_custom_menu_wizard</code> : if the menu is produced from a <code>[cmwizard]</code> shortcode then this class is assigned
|
1316 |
+
to the element that wraps the output.</li>
|
1317 |
+
</ul>
|
1318 |
+
|
1319 |
+
|
1320 |
+
</div></div></div><div class="panel panel-info"><a class="panel-heading show" role="tab" id="faq-14-heading" data-toggle="collapse" href="#faq-14" aria-expanded="false" aria-controls="faq-14"><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 find all my posts/pages that have a CMW shortcode so that I can upgrade them?</h4></a><div id="faq-14" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faq-14-heading"><div class="panel-body">
|
1321 |
|
1322 |
|
1323 |
<p>There is a button on the widget's "assist" - <code>[...]</code> - that will provide a list of posts/pages whose content, or meta data (custom fields),
|
1330 |
Note that output from this shortcode extension is restricted to users with edit_pages capability.</p>
|
1331 |
|
1332 |
|
1333 |
+
</div></div></div><div class="panel panel-info"><a class="panel-heading show" role="tab" id="faq-15-heading" data-toggle="collapse" href="#faq-15" aria-expanded="false" aria-controls="faq-15"><h4 class="panel-title"><span class="glyphicon glyphicon-triangle-bottom pull-right"></span><span class="glyphicon glyphicon-triangle-top pull-right"></span>Is Version 2 of the widget, including the old [custom_menu_wizard/] shortcode, still supported?</h4></a><div id="faq-15" class="panel-collapse collapse" role="tabpanel" aria-labelledby="faq-15-heading"><div class="panel-body">
|
1334 |
|
1335 |
|
1336 |
<p>In Version 3, Yes. However, I highly recommend that you upgrade your widgets & shortcodes to the latest versions,
|
1337 |
because Version 2 will <strong>not</strong> be supported beyond Version 3.</p>
|
1338 |
</div></div></div></div> </div>
|
1339 |
+
<div role="tabpanel" class="tab-pane fade" id="Screenshots">
|
1340 |
+
<h2>Screenshots</h2>
|
1341 |
+
<div class="row packery" data-packery='{"itemSelector":".packery-item","percentPosition":true,"initLayout":false}'>
|
1342 |
+
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 packery-item"><div class="caption"><h4>Widget</h4></div><a href="//ps.w.org/custom-menu-wizard/assets/screenshot-1.png?ver=3.3.0" class="thumbnail" target="_blank"><img src="//ps.w.org/custom-menu-wizard/assets/screenshot-1.png?ver=3.3.0" alt=""/></a></div>
|
1343 |
+
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 packery-item"><div class="caption"><h4>Filters Section</h4></div><a href="//ps.w.org/custom-menu-wizard/assets/screenshot-2.png?ver=3.3.0" class="thumbnail" target="_blank"><img src="//ps.w.org/custom-menu-wizard/assets/screenshot-2.png?ver=3.3.0" alt=""/></a></div>
|
1344 |
+
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 packery-item"><div class="caption"><h4>Fallbacks Section</h4></div><a href="//ps.w.org/custom-menu-wizard/assets/screenshot-3.png?ver=3.3.0" class="thumbnail" target="_blank"><img src="//ps.w.org/custom-menu-wizard/assets/screenshot-3.png?ver=3.3.0" alt=""/></a></div>
|
1345 |
+
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 packery-item"><div class="caption"><h4>Output Section</h4></div><a href="//ps.w.org/custom-menu-wizard/assets/screenshot-4.png?ver=3.3.0" class="thumbnail" target="_blank"><img src="//ps.w.org/custom-menu-wizard/assets/screenshot-4.png?ver=3.3.0" alt=""/></a></div>
|
1346 |
+
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 packery-item"><div class="caption"><h4>Container Section</h4></div><a href="//ps.w.org/custom-menu-wizard/assets/screenshot-5.png?ver=3.3.0" class="thumbnail" target="_blank"><img src="//ps.w.org/custom-menu-wizard/assets/screenshot-5.png?ver=3.3.0" alt=""/></a></div>
|
1347 |
+
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 packery-item"><div class="caption"><h4>Classes Section</h4></div><a href="//ps.w.org/custom-menu-wizard/assets/screenshot-6.png?ver=3.3.0" class="thumbnail" target="_blank"><img src="//ps.w.org/custom-menu-wizard/assets/screenshot-6.png?ver=3.3.0" alt=""/></a></div>
|
1348 |
+
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 packery-item"><div class="caption"><h4>Links Section</h4></div><a href="//ps.w.org/custom-menu-wizard/assets/screenshot-7.png?ver=3.3.0" class="thumbnail" target="_blank"><img src="//ps.w.org/custom-menu-wizard/assets/screenshot-7.png?ver=3.3.0" alt=""/></a></div>
|
1349 |
+
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 packery-item"><div class="caption"><h4>Alternative Section</h4></div><a href="//ps.w.org/custom-menu-wizard/assets/screenshot-8.png?ver=3.3.0" class="thumbnail" target="_blank"><img src="//ps.w.org/custom-menu-wizard/assets/screenshot-8.png?ver=3.3.0" alt=""/></a></div>
|
1350 |
+
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-6 packery-item"><div class="caption"><h4>Widget's "assist"</h4></div><a href="//ps.w.org/custom-menu-wizard/assets/screenshot-9.png?ver=3.3.0" class="thumbnail" target="_blank"><img src="//ps.w.org/custom-menu-wizard/assets/screenshot-9.png?ver=3.3.0" alt=""/></a></div>
|
1351 |
+
</div> </div>
|
1352 |
<div role="tabpanel" class="tab-pane fade" id="Changelog">
|
1353 |
<h2>Changelog</h2>
|
1354 |
+
<h4>3.3.0</h4>
|
1355 |
+
|
1356 |
+
<ul>
|
1357 |
+
<li>change : <strong>minimum WordPress version is now 3.9!</strong> (because require .dashicons-before, as part of needing to dump jQuery UI theme)</li>
|
1358 |
+
<li>bugfix : <strong>! Possible Breaker !</strong> fixed incorrect determination of current item when a "current menu item" has a duplicate of itself as an ancestor (hopefully rare). There is a (very slight) chance that this may affect your displayed menu : if it does, toggle the Fallback option for <em>If more than 1 possible Current Item</em>, and I apologise for not catching the problem earlier</li>
|
1359 |
+
<li>change : dumped jQuery UI's Smoothness theme for WordPress's own CSS, to work around styling issues with WP4.5</li>
|
1360 |
+
<li>change : removed the hide_empty option (only relevant pre WP3.6) entirely</li>
|
1361 |
+
<li>change : remove support for Widget Customizer plugin (part of core from WP3.9)</li>
|
1362 |
+
<li>change : localized all text used by assist, to reduce byte footprint of the widget</li>
|
1363 |
+
<li>add : in customizer, if there are no menus, link to the customizer's menus panel</li>
|
1364 |
+
<li>add : opt in to customizer selective refresh for widgets (WP4.5)</li>
|
1365 |
+
<li>bugfix : correction to regexps that sanitize the alternative</li>
|
1366 |
+
<li>bugfix : corrected some problems with the assist dialog's auto-sizing, particularly after dragging</li>
|
1367 |
+
<li>tweak : squidged the widget form a bit, to reduce byte footprint of the widget</li>
|
1368 |
+
<li>tweak : included screenshots in html version of documentation</li>
|
1369 |
+
</ul>
|
1370 |
+
|
1371 |
+
<h4>3.2.6</h4>
|
1372 |
|
1373 |
<ul>
|
1374 |
<li>addition : add cmw-current-item class to the menu item that CMW is using as 'current item'</li>
|
1637 |
<div class="gotoprev"><a class='btn btn-warning' href='#Description'><span class="glyphicon glyphicon-chevron-left"></span><span class="sr-only">return to previous tab and location</span></a></div>
|
1638 |
<div class="gototop" data-spy="affix" data-offset-top="100"><a class='btn btn-info' href='#Top'><span class="glyphicon glyphicon-chevron-up"></span><span class="sr-only">go to top of page</span></a></div>
|
1639 |
|
1640 |
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
1641 |
+
<script src="https://npmcdn.com/packery@2.0/dist/packery.pkgd.min.js"></script>
|
1642 |
<script type="text/javascript">
|
1643 |
jQuery(function($){
|
1644 |
var scrollWin = function(to){
|
1745 |
active.removeData('scroller');
|
1746 |
scrollWin(prevdata.scrollto);
|
1747 |
}
|
1748 |
+
$(active.attr('href')).find('.packery').packery();
|
1749 |
});
|
1750 |
});
|
1751 |
</script>
|
include/class.walker.php
CHANGED
@@ -173,6 +173,9 @@ class Custom_Menu_Wizard_Walker extends Walker_Nav_Menu {
|
|
173 |
//should(!) never get either parent and/or ancestor on an item marked as "current", but unfortunately it does occur (grrr!).
|
174 |
//so this has to cope, not only with more than 1 "current" item, but also with "current" items that are incorrectly marked
|
175 |
//as (their own?!) parent and/or ancestor.
|
|
|
|
|
|
|
176 |
//
|
177 |
//v3.1.0 : there are also occasions when the item is given a class of current-menu-item but the 'current' property is not set
|
178 |
//on the item - one such occasion being when the home page is set to latest posts (the default 'blogging' setting for Front
|
@@ -237,19 +240,19 @@ class Custom_Menu_Wizard_Walker extends Walker_Nav_Menu {
|
|
237 |
if( $item->current ){
|
238 |
if( $item->current_item_ancestor ){
|
239 |
if( $item->current_item_parent ){
|
240 |
-
$j = 'c';
|
241 |
}else{
|
242 |
-
$j = 'd';
|
243 |
}
|
244 |
}elseif( $item->current_item_parent ){
|
245 |
-
$j = 'b';
|
246 |
}else{
|
247 |
-
$j = 'a';
|
248 |
}
|
249 |
}elseif( $hasCurrentClass ){
|
250 |
-
$j = 'e';
|
251 |
}else{
|
252 |
-
$j = 'f';
|
253 |
}
|
254 |
$currentItem[ $j . sprintf( '%03d' , abs( count( $currentItem ) + $ciSequencer ) ) ] = $itemID;
|
255 |
}
|
@@ -298,8 +301,8 @@ 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 |
-
//if this is the
|
302 |
-
if( $parentID
|
303 |
$this->_cmw_tree[ $parentID ]['classes'][] = 'cmw-menu-item-had-children';
|
304 |
}
|
305 |
|
@@ -325,6 +328,38 @@ class Custom_Menu_Wizard_Walker extends Walker_Nav_Menu {
|
|
325 |
if( empty( $currentItem ) ){
|
326 |
$currentItem = false;
|
327 |
}else{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
ksort( $currentItem );
|
329 |
$currentItem = array_shift( $currentItem );
|
330 |
//add an extra class to the item that CMW is using as "current item"...
|
173 |
//should(!) never get either parent and/or ancestor on an item marked as "current", but unfortunately it does occur (grrr!).
|
174 |
//so this has to cope, not only with more than 1 "current" item, but also with "current" items that are incorrectly marked
|
175 |
//as (their own?!) parent and/or ancestor.
|
176 |
+
//UPDATE April 2016 : the above statement is inaccurate - if Page Alpha (current) is at root, and Page Alpha is also
|
177 |
+
//somewhere below that root item, then the root Alpha can legitmately be an ancestor, and maybe the parent, of the
|
178 |
+
//Alpha (also current) below it.
|
179 |
//
|
180 |
//v3.1.0 : there are also occasions when the item is given a class of current-menu-item but the 'current' property is not set
|
181 |
//on the item - one such occasion being when the home page is set to latest posts (the default 'blogging' setting for Front
|
240 |
if( $item->current ){
|
241 |
if( $item->current_item_ancestor ){
|
242 |
if( $item->current_item_parent ){
|
243 |
+
$j = 'c'; //current, ancestor, parent
|
244 |
}else{
|
245 |
+
$j = 'd'; //current, ancestor
|
246 |
}
|
247 |
}elseif( $item->current_item_parent ){
|
248 |
+
$j = 'b'; //current, parent
|
249 |
}else{
|
250 |
+
$j = 'a'; //current
|
251 |
}
|
252 |
}elseif( $hasCurrentClass ){
|
253 |
+
$j = 'e'; //.current-menu-item
|
254 |
}else{
|
255 |
+
$j = 'f'; //possible parent fallback
|
256 |
}
|
257 |
$currentItem[ $j . sprintf( '%03d' , abs( count( $currentItem ) + $ciSequencer ) ) ] = $itemID;
|
258 |
}
|
301 |
$this->_cmw_tree[ $itemID ]['ancestors'][] = $parentID;
|
302 |
//add this item to its parent's kids...
|
303 |
$this->_cmw_tree[ $parentID ]['kids'][] = $itemID;
|
304 |
+
//if this is the parent's first kid, give it (the parent) a had-kids class...
|
305 |
+
if( isset( $this->_cmw_tree[ $parentID ]['classes'] ) && count( $this->_cmw_tree[ $parentID ]['kids'] ) == 1 ){
|
306 |
$this->_cmw_tree[ $parentID ]['classes'][] = 'cmw-menu-item-had-children';
|
307 |
}
|
308 |
|
328 |
if( empty( $currentItem ) ){
|
329 |
$currentItem = false;
|
330 |
}else{
|
331 |
+
|
332 |
+
//if we have more than 1 candidate for current item then I need to check that there aren't some
|
333 |
+
//current + ancestor|parent items that should be upgraded to full current (ie. cNNN -> aNNN)
|
334 |
+
//eg. given Page A -> Page B -> Page A, and Page A is current
|
335 |
+
// then grand-child Page A will (should!) be *just current*, and the root Page A will legitimately
|
336 |
+
// be current AND ancestor, but I need to re-classify as *just current* because otherwise I don't
|
337 |
+
// have multiple legitimate/equivalent contenders for 'current', and FIFO/LIFO becomes irrelevant.
|
338 |
+
//does this work for Page A -> Page A -> Page A?
|
339 |
+
// - the major loop will only pick up the grand-child
|
340 |
+
// - the intersect will return the root and the child
|
341 |
+
// - both the root and the child are current so both will be upgraded
|
342 |
+
// so, yes.
|
343 |
+
if( count( $currentItem > 1 ) ){
|
344 |
+
foreach( $currentItem as $k => $v ){
|
345 |
+
//if item is *just current* (ie. marked as current, without being either ancestor or parent)...
|
346 |
+
if( substr( $k, 0, 1 ) == 'a' ){
|
347 |
+
//run through other potential current items that are ancestors of this item (re-use $k)...
|
348 |
+
foreach( array_intersect( $currentItem, $this->_cmw_tree[ $v ]['ancestors'] ) as $k => $itemID ){
|
349 |
+
//if an ancestor is current + parent|ancestor, then promote to just current...
|
350 |
+
$prefix = substr( $k, 0, 1 );
|
351 |
+
if( $prefix == 'b' || $prefix == 'c' || $prefix == 'd' ){
|
352 |
+
//promotion means adding a new item, key being same sequence no. but an 'a' prefix,
|
353 |
+
//and keeping same value (item id)...
|
354 |
+
$currentItem[ 'a' . substr( $k, 1 ) ] = $itemID;
|
355 |
+
//...and removing the old item...
|
356 |
+
unset( $currentItem[ $k ] );
|
357 |
+
}
|
358 |
+
}
|
359 |
+
}
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
ksort( $currentItem );
|
364 |
$currentItem = array_shift( $currentItem );
|
365 |
//add an extra class to the item that CMW is using as "current item"...
|
include/class.widget.php
CHANGED
@@ -17,7 +17,10 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
17 |
array(
|
18 |
'classname' => 'widget_custom_menu_wizard',
|
19 |
'description' => __('Add a custom menu, or part of one, as a widget', 'custom-menu-wizard'),
|
20 |
-
|
|
|
|
|
|
|
21 |
)
|
22 |
);
|
23 |
$this->_cmw_legacy_warnreadmore = 'http://wordpress.org/plugins/' . $this->id_base . '/changelog/';
|
@@ -64,21 +67,31 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
64 |
$instance = self::cmw_settings( $instance, array(), __FUNCTION__ );
|
65 |
|
66 |
//if no populated menus exist, suggest the user go create one...
|
67 |
-
if( ( $menus = $this->cmw_scan_menus( $instance['menu'], $instance['branch'] ) ) === false )
|
68 |
-
|
69 |
<p class="widget-<?php echo $this->id_base; ?>-no-menus">
|
70 |
-
<em><?php printf(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
<input id="<?php echo $this->get_field_id('cmwv'); ?>" name="<?php echo $this->get_field_name('cmwv'); ?>"
|
72 |
type="hidden" value="<?php echo Custom_Menu_Wizard_Plugin::$version; ?>" />
|
73 |
-
<?php foreach( array('filters', 'fallbacks', 'output', 'container', 'classes', 'links') as $v )
|
74 |
<input id="<?php echo $this->get_field_id("fs_$v"); ?>" name="<?php echo $this->get_field_name("fs_$v"); ?>"
|
75 |
type="hidden" value="<?php echo $instance["fs_$v"] ? '1' : '0' ?>" />
|
76 |
-
<?php
|
77 |
</p>
|
78 |
<?php
|
79 |
//all done : quit...
|
80 |
return;
|
81 |
-
|
82 |
|
83 |
//create the OPTIONs for the relative & absolute optgroups in the branch level select...
|
84 |
$absGroup = array();
|
@@ -134,38 +147,28 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
134 |
|
135 |
//NB the 'onchange' wrapper holds any text required by the "assist"
|
136 |
?>
|
137 |
-
<div id="<?php echo $this->get_field_id('onchange'); ?>"
|
138 |
-
class="widget-<?php echo $this->id_base; ?>-onchange<?php echo $this->cmw_wp_version('3.8') ? ' cmw-pre-wp-v38' : ''; ?>"
|
139 |
-
data-cmw-v36plus='<?php echo $this->cmw_wp_version('3.6', true) ? 'true' : 'false'; ?>'
|
140 |
-
data-cmw-dialog-prompt='<?php _e('Click an item to toggle "Current Menu Item"', 'custom-menu-wizard'); ?>'
|
141 |
-
data-cmw-dialog-output='<?php _e('Basic Output', 'custom-menu-wizard'); ?>'
|
142 |
-
data-cmw-dialog-alternative='<?php _e('Alternative settings', 'custom-menu-wizard'); ?>'
|
143 |
-
data-cmw-dialog-fallback='<?php _e('Fallback invoked', 'custom-menu-wizard'); ?>'
|
144 |
-
data-cmw-dialog-inclusions='<?php _e('Inclusions', 'custom-menu-wizard'); ?> : 0'
|
145 |
-
data-cmw-dialog-exclusions='<?php _e('Exclusions', 'custom-menu-wizard'); ?> : 0'
|
146 |
-
data-cmw-dialog-set-current='<?php _e('No Current Item!', 'custom-menu-wizard'); ?>'
|
147 |
-
data-cmw-dialog-shortcodes='<?php _e('Find posts/pages containing a CMW shortcode', 'custom-menu-wizard'); ?>'
|
148 |
-
data-cmw-dialog-untitled='<?php _e('untitled', 'custom-menu-wizard'); ?>'
|
149 |
-
data-cmw-dialog-fixed='<?php _e('fixed', 'custom-menu-wizard'); ?>'
|
150 |
-
data-cmw-dialog-nonce='<?php echo wp_create_nonce( 'cmw-find-shortcodes' ); ?>'
|
151 |
-
data-cmw-dialog-version='<?php echo Custom_Menu_Wizard_Plugin::$version; ?>'
|
152 |
-
data-cmw-dialog-id='<?php echo $this->get_field_id('dialog'); ?>'>
|
153 |
|
|
|
|
|
|
|
|
|
|
|
154 |
<?php
|
155 |
/**
|
156 |
* permanently visible section : Title (with Hide) and Menu
|
157 |
*/
|
158 |
?>
|
|
|
159 |
<p>
|
160 |
-
<input
|
161 |
-
|
162 |
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'custom-menu-wizard') ?></label>
|
163 |
-
|
164 |
array(
|
165 |
'label' => _x('Hide', 'verb', 'custom-menu-wizard'),
|
166 |
'lclass' => 'alignright'
|
167 |
) ); ?>
|
168 |
-
|
169 |
array(
|
170 |
'fclass' => 'widefat cmw-widget-title'
|
171 |
) ); ?>
|
@@ -173,59 +176,53 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
173 |
|
174 |
<p>
|
175 |
<label for="<?php echo $this->get_field_id('menu'); ?>"><?php _e('Select Menu:', 'custom-menu-wizard'); ?></label>
|
176 |
-
<select id="<?php echo $this->get_field_id('menu'); ?>"
|
177 |
-
|
178 |
-
<?php echo $menus['names']; ?>
|
179 |
-
</select>
|
180 |
</p>
|
181 |
-
|
182 |
<?php
|
183 |
/**
|
184 |
* start collapsible section : 'Filter'
|
185 |
*/
|
186 |
$this->cmw_open_a_field_section( $instance, __('Filters', 'custom-menu-wizard'), 'fs_filters' ); ?>
|
187 |
|
188 |
-
<div>
|
189 |
-
<?php $this->cmw_assist_link(); ?>
|
190 |
-
<strong><?php _e('Primary Filter', 'custom-menu-wizard'); ?></strong>
|
191 |
|
192 |
<div class="cmw-indented">
|
193 |
<label class="cmw-verticalalign-baseline">
|
194 |
-
<input
|
|
|
195 |
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('filter'); ?>"
|
196 |
-
type="radio" value="" <?php checked( $instance['filter'], '' ); ?>
|
197 |
/><?php _e('Level:', 'custom-menu-wizard'); ?></label>
|
198 |
<select id="<?php echo $this->get_field_id('level'); ?>" class="cmw-level cmw-set-levels cmw-listen"
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
</div>
|
206 |
|
207 |
<div class="cmw-indented">
|
208 |
<label class="cmw-verticalalign-baseline">
|
209 |
-
<input
|
|
|
210 |
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('filter'); ?>"
|
211 |
-
type="radio" value="branch" <?php checked( $instance['filter'], 'branch' ); ?>
|
212 |
/><?php _e('Branch:', 'custom-menu-wizard'); ?></label>
|
213 |
<select id="<?php echo $this->get_field_id('branch'); ?>" class="cmw-branches cmw-assist-items cmw-listen"
|
214 |
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('branch'); ?>">
|
215 |
<option value="0" <?php selected( $instance['branch'], 0 ); ?>><?php _e('Current Item', 'custom-menu-wizard'); ?></option>
|
216 |
-
<?php echo $menus['selectedOptgroup'];
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
</select>
|
222 |
</div>
|
223 |
|
224 |
<div class="cmw-indented">
|
225 |
<label class="cmw-verticalalign-baseline">
|
226 |
-
<input
|
|
|
227 |
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('filter'); ?>"
|
228 |
-
type="radio" value="items" <?php checked( $instance['filter'], 'items' ); ?>
|
229 |
/><?php _e('Items:', 'custom-menu-wizard'); ?></label>
|
230 |
<?php $this->cmw_formfield_textbox( $instance, 'items',
|
231 |
array(
|
@@ -234,118 +231,107 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
234 |
</div>
|
235 |
</div>
|
236 |
|
237 |
-
<div class="cmw-disableif-ss<?php $this->cmw_disableif( 'push', $isByItems ); ?>">
|
238 |
-
<?php $this->cmw_assist_link(); ?>
|
239 |
-
<strong><?php _e('Secondary Filter', 'custom-menu-wizard'); ?></strong>
|
240 |
|
241 |
<div class="cmw-indented">
|
242 |
<label class="cmw-disableifnot-br<?php $this->cmw_disableif( 'push', $isNotByBranch ); ?>"><?php _e('Starting at:', 'custom-menu-wizard'); ?>
|
|
|
243 |
<select id="<?php echo $this->get_field_id('branch_start'); ?>" class="cmw-branch-start cmw-listen"
|
244 |
-
|
245 |
-
<optgroup label="<?php _ex('relative...', 'adjective: cf. absolute', 'custom-menu-wizard'); ?>"
|
246 |
-
|
247 |
-
<?php echo implode( '', $relGroup ); ?>
|
248 |
-
</optgroup>
|
249 |
<optgroup label="<?php _e('absolute...', 'custom-menu-wizard'); ?>">
|
250 |
-
<?php echo implode( '', $absGroup );
|
251 |
-
|
252 |
-
</select></label><!-- end .cmw-disableifnot-br --><?php $this->cmw_disableif( 'pop' ); ?>
|
253 |
|
254 |
-
<br
|
255 |
-
<span class="cmw-disableifnot-br<?php $this->cmw_disableif( 'push', $isNotByBranch ); ?>">
|
256 |
<label class="cmw-followed-by">
|
257 |
-
<input
|
258 |
-
|
259 |
-
<?php $this->cmw_disableif(); ?>
|
260 |
/><?php _e('Item <small>(if possible)</small>', 'custom-menu-wizard'); ?></label>
|
261 |
|
262 |
<label class="cmw-followed-by cmw-whitespace-nowrap">
|
263 |
-
<input
|
264 |
-
<?php $this->
|
|
|
265 |
/><?php _e('Level', 'custom-menu-wizard'); ?></label>
|
266 |
-
|
267 |
-
<?php $this->cmw_formfield_checkbox( $instance, 'allow_all_root',
|
268 |
array(
|
269 |
'label' => __('Allow all Root Items', 'custom-menu-wizard'),
|
270 |
'lclass' => 'cmw-whitespace-nowrap'
|
271 |
) ); ?>
|
272 |
-
</span
|
273 |
</div>
|
274 |
|
275 |
<div class="cmw-indented">
|
276 |
<label class="cmw-followed-by"><?php _e('For Depth:', 'custom-menu-wizard'); ?>
|
277 |
-
<select id="<?php echo $this->get_field_id('depth'); ?>" data-cmw-text-levels="<?php _e(' levels', 'custom-menu-wizard'); ?>"
|
278 |
-
data-cmw-set-levels="1" <?php $this->cmw_disableif(); ?>
|
279 |
-
class="cmw-depth cmw-set-levels cmw-listen" name="<?php echo $this->get_field_name('depth'); ?>">
|
280 |
-
<option value="0" <?php selected( $instance['depth'] > $menus['selectedLevels'] ? 0 : $instance['depth'], 0 ); ?>><?php _e('unlimited', 'custom-menu-wizard'); ?></option>
|
281 |
-
<?php for( $i = 1; $i <= $menus['selectedLevels']; $i++ ){ ?>
|
282 |
-
<option value="<?php echo $i; ?>" <?php selected( $instance['depth'], $i ); ?>><?php printf( _n('%d level', '%d levels', $i, 'custom-menu-wizard'), $i ); ?></option>
|
283 |
-
<?php } ?>
|
284 |
-
</select></label>
|
285 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
|
287 |
-
|
288 |
array(
|
289 |
'label' => __('Relative to Current Item', 'custom-menu-wizard'),
|
290 |
'lclass' => 'cmw-disableif-ud cmw-whitespace-nowrap',
|
291 |
'disableif' => $isUnlimitedDepth
|
292 |
) ); ?>
|
293 |
</div>
|
294 |
-
</div
|
295 |
|
296 |
-
<div>
|
297 |
-
<?php $this->cmw_assist_link(); ?>
|
298 |
-
<strong><?php _e('Inclusions', 'custom-menu-wizard'); ?></strong>
|
299 |
|
300 |
<div class="cmw-indented">
|
301 |
<label class="cmw-disableifnot-br<?php $this->cmw_disableif( 'push', $isNotByBranch ); ?>"><?php _e('Branch Ancestors:', 'custom-menu-wizard'); ?>
|
302 |
-
|
303 |
-
|
304 |
-
|
|
|
305 |
<option value="0" <?php selected( $j, 0 ); ?>> </option>
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
<optgroup label="<?php _ex('relative...', 'adjective: cf. absolute', 'custom-menu-wizard'); ?>"
|
310 |
-
<option value="-1" <?php selected( $j, -1 ); ?>><?php _e('-1 level (parent)', 'custom-menu-wizard'); ?></option
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
<?php
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
<br />
|
324 |
-
<span class="cmw-disableifnot-br<?php $this->cmw_disableif( 'push', $isNotByBranch ); ?>">
|
325 |
<label><?php _e('... with Siblings:', 'custom-menu-wizard'); ?>
|
|
|
326 |
<select id="<?php echo $this->get_field_id('ancestor_siblings'); ?>" class="cmw-ancestor-siblings cmw-set-rel-abs-levels cmw-listen"
|
327 |
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('ancestor_siblings'); ?>">
|
328 |
<option value="0" <?php selected( $j, 0 ); ?>> </option>
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
<optgroup label="<?php _ex('relative...', 'adjective: cf. absolute', 'custom-menu-wizard'); ?>"
|
333 |
-
<option value="-1" <?php selected( $j, -1 ); ?>><?php _e('-1 level (parent)', 'custom-menu-wizard'); ?></option
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
<?php
|
341 |
-
|
342 |
-
<?php } ?>
|
343 |
-
</optgroup>
|
344 |
</select></label>
|
345 |
-
</span
|
346 |
</div>
|
347 |
|
348 |
-
|
349 |
array(
|
350 |
'label' => __('Branch Siblings', 'custom-menu-wizard'),
|
351 |
'lclass' => 'cmw-disableifnot-br',
|
@@ -354,25 +340,23 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
354 |
|
355 |
<div class="cmw-indented">
|
356 |
<label><?php _e('Level:', 'custom-menu-wizard'); ?>
|
|
|
357 |
<select id="<?php echo $this->get_field_id('include_level'); ?>" class="cmw-include-level"
|
358 |
name="<?php echo $this->get_field_name('include_level'); ?>">
|
359 |
-
|
360 |
-
<option value="" <?php selected( $j, '' ); ?>> </option
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
</select></label>
|
367 |
</div>
|
368 |
</div>
|
369 |
|
370 |
-
<div>
|
371 |
-
<?php $this->cmw_assist_link(); ?>
|
372 |
-
<strong><?php _e('Exclusions', 'custom-menu-wizard'); ?></strong>
|
373 |
|
374 |
<div class="cmw-indented">
|
375 |
-
|
376 |
array(
|
377 |
'label' => __('Item Ids:', 'custom-menu-wizard'),
|
378 |
'fclass' => 'cmw-maxwidth-twothirds cmw-exclusions'
|
@@ -381,31 +365,29 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
381 |
|
382 |
<div class="cmw-indented">
|
383 |
<label><?php _e('Level:', 'custom-menu-wizard'); ?>
|
|
|
384 |
<select id="<?php echo $this->get_field_id('exclude_level'); ?>" class="cmw-exclude-level"
|
385 |
name="<?php echo $this->get_field_name('exclude_level'); ?>">
|
386 |
-
|
387 |
-
<option value="" <?php selected( $j, '' ); ?>> </option
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
</select></label>
|
394 |
</div>
|
395 |
</div>
|
396 |
|
397 |
-
<div>
|
398 |
-
<?php $this->cmw_assist_link(); ?>
|
399 |
-
<strong><?php _e('Qualifier', 'custom-menu-wizard'); ?></strong>
|
400 |
<br /><label for="<?php echo $this->get_field_id('contains_current'); ?>"><?php _e('Current Item is in:', 'custom-menu-wizard'); ?></label>
|
401 |
<select id="<?php echo $this->get_field_id('contains_current'); ?>"
|
402 |
-
|
403 |
-
<option value="" <?php selected( $instance['contains_current'], '' ); ?>> </option
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
</select>
|
410 |
</div>
|
411 |
|
@@ -417,46 +399,41 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
417 |
*/
|
418 |
$this->cmw_open_a_field_section( $instance, __('Fallbacks', 'custom-menu-wizard'), 'fs_fallbacks' ); ?>
|
419 |
|
420 |
-
<div class="cmw-disableifnot-br-ci<?php $this->cmw_disableif( 'push', $isNotBranchCurrentItem ); ?>"
|
421 |
-
<?php $this->cmw_assist_link(); ?>
|
422 |
|
423 |
<div class="cmw-indented">
|
424 |
<label for="<?php echo $this->get_field_id('fallback'); ?>"><strong><?php _e('If Current Item has no children:', 'custom-menu-wizard'); ?></strong></label>
|
425 |
<select id="<?php echo $this->get_field_id('fallback'); ?>" class="cmw-fallback cmw-listen"
|
426 |
-
|
427 |
-
<option value="" <?php selected( $instance['fallback'], '' ); ?>> </option
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
</select>
|
432 |
|
433 |
-
<br
|
434 |
-
|
435 |
-
<?php $this->cmw_formfield_checkbox( $instance, 'fallback_siblings',
|
436 |
array(
|
437 |
'label' => '…' . __('and Include its Siblings', 'custom-menu-wizard')
|
438 |
) ); ?>
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
<?php
|
447 |
-
|
448 |
-
<?php } ?>
|
449 |
-
</select></label>
|
450 |
<span class="cmw-small-block cmw-indented"><em class="cmw-colour-grey"><?php _e('Fallback Depth is Relative to Current Item!', 'custom-menu-wizard'); ?></em></span>
|
451 |
-
</span
|
452 |
</div>
|
453 |
|
454 |
-
</div
|
455 |
|
456 |
<div>
|
457 |
-
<div class="cmw-indented"><strong><?php _e('If no Current Item can be found:', 'custom-menu-wizard'); ?></strong
|
458 |
-
|
459 |
-
<?php $this->cmw_formfield_checkbox( $instance, 'fallback_ci_parent',
|
460 |
array(
|
461 |
'label' => __('Try items marked Parent of Current', 'custom-menu-wizard')
|
462 |
) ); ?>
|
@@ -465,9 +442,8 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
465 |
</div>
|
466 |
|
467 |
<div>
|
468 |
-
<div class="cmw-indented"><strong><?php _e('If more than 1 possible Current Item:', 'custom-menu-wizard'); ?></strong
|
469 |
-
|
470 |
-
<?php $this->cmw_formfield_checkbox( $instance, 'fallback_ci_lifo',
|
471 |
array(
|
472 |
'label' => __('Use the <strong>last</strong> one found', 'custom-menu-wizard')
|
473 |
) ); ?>
|
@@ -483,17 +459,17 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
483 |
*/
|
484 |
$this->cmw_open_a_field_section( $instance, __('Output', 'custom-menu-wizard'), 'fs_output' ); ?>
|
485 |
|
486 |
-
<div
|
487 |
-
|
488 |
<label class="cmw-followed-by">
|
489 |
-
<input
|
490 |
-
|
491 |
-
<?php $this->cmw_disableif(); ?>
|
492 |
/><?php _e('Hierarchical', 'custom-menu-wizard'); ?></label>
|
493 |
<label class="cmw-whitespace-nowrap">
|
494 |
-
<input
|
495 |
-
|
496 |
-
<?php $this->cmw_disableif(); ?>
|
497 |
/><?php _e('Flat', 'custom-menu-wizard'); ?></label>
|
498 |
</div>
|
499 |
|
@@ -502,91 +478,63 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
502 |
|
503 |
<div class="cmw-indented">
|
504 |
<label><?php _e('Current Item:', 'custom-menu-wizard'); $j = $instance['title_current']; ?>
|
|
|
505 |
<select id="<?php echo $this->get_field_id('title_current'); ?>" class="cmw-title-from cmw-set-rel-abs-levels cmw-listen"
|
506 |
-
|
507 |
-
data-cmw-text-level="<?php _e('level', 'custom-menu-wizard'); ?>">
|
508 |
<option value="" <?php selected( $j, "" ); ?>> </option>
|
509 |
<option value="0" <?php selected( $j, "0" ); ?>><?php _e('the Current Item', 'custom-menu-wizard'); ?></option>
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
<?php
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
<option value="<?php echo $i; ?>" <?php selected( $j, "$i" ); ?>><?php printf( __('level %d', 'custom-menu-wizard'), $i ); ?></option>
|
522 |
-
<?php } ?>
|
523 |
-
</optgroup>
|
524 |
</select></label>
|
525 |
</div>
|
526 |
<div class="cmw-indented">
|
527 |
<label class="cmw-disableifnot-br<?php $this->cmw_disableif( 'push', $isNotByBranch ); ?>"><?php _e('Branch Item:', 'custom-menu-wizard'); $j = $instance['title_branch']; ?>
|
|
|
528 |
<select id="<?php echo $this->get_field_id('title_branch'); ?>" class="cmw-title-from cmw-set-rel-abs-levels cmw-listen"
|
529 |
-
|
530 |
-
data-cmw-text-level="<?php _e('level', 'custom-menu-wizard'); ?>">
|
531 |
<option value="" <?php selected( $j, "" ); ?>> </option>
|
532 |
<option value="0" <?php selected( $j, "0" ); ?>><?php _e('the Branch Item', 'custom-menu-wizard'); ?></option>
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
<?php
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
<?php } ?>
|
546 |
-
</optgroup>
|
547 |
-
</select></label><!-- end .cmw-disableifnot-br --><?php $this->cmw_disableif( 'pop' ); ?>
|
548 |
</div>
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
array(
|
553 |
'label' => __('Make it a Link', 'custom-menu-wizard')
|
554 |
-
) );
|
555 |
-
</div>
|
556 |
</div>
|
557 |
|
558 |
-
<div
|
559 |
-
|
560 |
-
<br />
|
561 |
-
<?php $this->cmw_formfield_checkbox( $instance, 'ol_root',
|
562 |
array(
|
563 |
'label' => __('Top Level', 'custom-menu-wizard'),
|
564 |
'lclass' => 'cmw-followed-by'
|
565 |
) ); ?>
|
566 |
-
|
567 |
array(
|
568 |
'label' => __('Sub-Levels', 'custom-menu-wizard'),
|
569 |
'lclass' => 'cmw-whitespace-nowrap'
|
570 |
-
) );
|
571 |
-
</div>
|
572 |
-
|
573 |
-
<?php
|
574 |
-
//v1.1.0 As of WP v3.6, wp_nav_menu() automatically cops out (without outputting any HTML) if there are no items,
|
575 |
-
// so the hide_empty option becomes superfluous; however, I'll keep the previous setting (if there was one)
|
576 |
-
// in case of reversion to an earlier version of WP...
|
577 |
-
if( $this->cmw_wp_version('3.6') ){
|
578 |
-
?>
|
579 |
-
<div>
|
580 |
-
<?php $this->cmw_formfield_checkbox( $instance, 'hide_empty',
|
581 |
-
array(
|
582 |
-
'label' => __('Hide Widget if Empty', 'custom-menu-wizard'),
|
583 |
-
'desc' => __('Prevents any output when no items are found', 'custom-menu-wizard')
|
584 |
-
) ); ?>
|
585 |
-
</div>
|
586 |
-
<?php }else{ ?>
|
587 |
-
<input id="<?php echo $this->get_field_id('hide_empty'); ?>" name="<?php echo $this->get_field_name('hide_empty'); ?>"
|
588 |
-
type="hidden" value="<?php echo $instance['hide_empty'] ? '1' : ''; ?>" />
|
589 |
-
<?php } ?>
|
590 |
|
591 |
<?php $this->cmw_close_a_field_section(); ?>
|
592 |
|
@@ -596,27 +544,23 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
596 |
*/
|
597 |
$this->cmw_open_a_field_section( $instance, __('Container', 'custom-menu-wizard'), 'fs_container' ); ?>
|
598 |
|
599 |
-
<div
|
600 |
-
<?php $this->cmw_formfield_textbox( $instance, 'container',
|
601 |
array(
|
602 |
'label' => __('Element:', 'custom-menu-wizard'),
|
603 |
'desc' => __('Eg. div or nav; leave empty for no container', 'custom-menu-wizard')
|
604 |
-
) );
|
605 |
-
|
606 |
-
<div
|
607 |
-
<?php $this->cmw_formfield_textbox( $instance, 'container_id',
|
608 |
array(
|
609 |
'label' => __('Unique ID:', 'custom-menu-wizard'),
|
610 |
'desc' => __('An optional ID for the container', 'custom-menu-wizard')
|
611 |
-
) );
|
612 |
-
|
613 |
-
<div
|
614 |
-
<?php $this->cmw_formfield_textbox( $instance, 'container_class',
|
615 |
array(
|
616 |
'label' => __('Class:', 'custom-menu-wizard'),
|
617 |
'desc' => __('Extra class for the container', 'custom-menu-wizard')
|
618 |
-
) );
|
619 |
-
</div>
|
620 |
|
621 |
<?php $this->cmw_close_a_field_section(); ?>
|
622 |
|
@@ -626,20 +570,17 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
626 |
*/
|
627 |
$this->cmw_open_a_field_section( $instance, __('Classes', 'custom-menu-wizard'), 'fs_classes' ); ?>
|
628 |
|
629 |
-
<div
|
630 |
-
<?php $this->cmw_formfield_textbox( $instance, 'menu_class',
|
631 |
array(
|
632 |
'label' => __('Menu Class:', 'custom-menu-wizard'),
|
633 |
'desc' => __('Class for the list element forming the menu', 'custom-menu-wizard')
|
634 |
-
) );
|
635 |
-
|
636 |
-
<div
|
637 |
-
<?php $this->cmw_formfield_textbox( $instance, 'widget_class',
|
638 |
array(
|
639 |
'label' => __('Widget Class:', 'custom-menu-wizard'),
|
640 |
'desc' => __('Extra class for the widget itself', 'custom-menu-wizard')
|
641 |
-
) );
|
642 |
-
</div>
|
643 |
|
644 |
<?php $this->cmw_close_a_field_section(); ?>
|
645 |
|
@@ -649,38 +590,33 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
649 |
*/
|
650 |
$this->cmw_open_a_field_section( $instance, __('Links', 'custom-menu-wizard'), 'fs_links' ); ?>
|
651 |
|
652 |
-
<div
|
653 |
-
<?php $this->cmw_formfield_textbox( $instance, 'before',
|
654 |
array(
|
655 |
'label' => __('Before the Link:', 'custom-menu-wizard'),
|
656 |
'desc' =>__( htmlspecialchars('Text/HTML to go before the </a> of the link') , 'custom-menu-wizard'),
|
657 |
'fclass' => 'widefat'
|
658 |
-
) );
|
659 |
-
|
660 |
-
<div
|
661 |
-
<?php $this->cmw_formfield_textbox( $instance, 'after',
|
662 |
array(
|
663 |
'label' => __('After the Link:', 'custom-menu-wizard'),
|
664 |
'desc' => __( htmlspecialchars('Text/HTML to go after the </a> of the link') , 'custom-menu-wizard'),
|
665 |
'fclass' => 'widefat'
|
666 |
-
) );
|
667 |
-
|
668 |
-
<div
|
669 |
-
<?php $this->cmw_formfield_textbox( $instance, 'link_before',
|
670 |
array(
|
671 |
'label' => __('Before the Link Text:', 'custom-menu-wizard'),
|
672 |
'desc' => __('Text/HTML to go before the link text', 'custom-menu-wizard'),
|
673 |
'fclass' => 'widefat'
|
674 |
-
) );
|
675 |
-
|
676 |
-
<div
|
677 |
-
<?php $this->cmw_formfield_textbox( $instance, 'link_after',
|
678 |
array(
|
679 |
'label' => __('After the Link Text:', 'custom-menu-wizard'),
|
680 |
'desc' => __('Text/HTML to go after the link text', 'custom-menu-wizard'),
|
681 |
'fclass' => 'widefat'
|
682 |
-
) );
|
683 |
-
</div>
|
684 |
|
685 |
<?php $this->cmw_close_a_field_section(); ?>
|
686 |
|
@@ -690,34 +626,33 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
690 |
*/
|
691 |
$this->cmw_open_a_field_section( $instance, __('Alternative', 'custom-menu-wizard'), 'fs_alternative' ); ?>
|
692 |
|
693 |
-
<div
|
694 |
-
<?php $this->cmw_assist_link(); ?>
|
695 |
|
696 |
<label for="<?php echo $this->get_field_id('switch_if'); ?>" class="cmw-followed-by"><?php _e('On condition:', 'custom-menu-wizard'); ?></label>
|
697 |
<br /><select id="<?php echo $this->get_field_id('switch_if'); ?>" class="cmw-switchable cmw-listen"
|
698 |
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('switch_if'); ?>">
|
699 |
-
<option value="" <?php selected( $instance['switch_if'], '' ); ?>> </option
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
</select>
|
704 |
|
705 |
<select id="<?php echo $this->get_field_id('switch_at'); ?>" class="cmw-switchable cmw-listen"
|
706 |
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('switch_at'); ?>">
|
707 |
-
<option value="" <?php selected( $instance['switch_at'], '' ); ?>> </option
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
</select>
|
714 |
|
715 |
-
<br
|
716 |
-
|
717 |
<br /><textarea rows="3" cols="20" <?php $this->cmw_disableif(); ?> id="<?php echo $this->get_field_id('switch_to'); ?>"
|
718 |
name="<?php echo $this->get_field_name('switch_to'); ?>"
|
719 |
class="widefat"><?php echo $instance['switch_to']; ?></textarea>
|
720 |
-
</label
|
721 |
<span class="cmw-small-block cmw-indented"><em class="cmw-colour-grey">Enter/Paste a [cmwizard.../] shortcode</em></span>
|
722 |
|
723 |
</div>
|
@@ -730,18 +665,23 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
730 |
<div class="cmw-shortcode-nojs cmw-small-block"><?php _e('With Javascript disabled, this is only guaranteed to be accurate when you <em>initially enter</em> Edit mode!', 'custom-menu-wizard'); ?></div>
|
731 |
<div class="cmw-shortcode-wrap"><code class="widget-<?php echo $this->id_base; ?>-shortcode ui-corner-all"
|
732 |
title="<?php esc_attr_e('stand-alone shortcode', 'custom-menu-wizard'); ?>"><?php echo self::cmw_shortcode( array_merge( $instance, array( 'menu' => $menus['selectedMenu'] ) ) ); ?></code></div>
|
733 |
-
|
734 |
<div class="cmw-small-block"><em class="cmw-colour-grey"><?php _e('This <u>specific widget</u> can also be included using...', 'custom-menu-wizard'); ?></em></div>
|
735 |
<div class="cmw-shortcode-wrap"><code class="widget-<?php echo $this->id_base; ?>-shortcode cmw-instance-shortcode ui-corner-all"
|
736 |
title="<?php esc_attr_e('dependent shortcode', 'custom-menu-wizard'); ?>">[cmwizard widget=<?php echo $this->number; ?>/]</code></div>
|
737 |
-
|
738 |
</div>
|
739 |
|
740 |
</div>
|
|
|
741 |
<?php
|
742 |
|
743 |
if( $this->_cmw_accessibility ){
|
744 |
-
wp_localize_script(
|
|
|
|
|
|
|
|
|
745 |
}
|
746 |
|
747 |
} //end form()
|
@@ -806,9 +746,6 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
806 |
//holds information determined by the walker...
|
807 |
$this->_cmw_walker = array();
|
808 |
|
809 |
-
//v1.1.0 As of WP v3.6, wp_nav_menu() automatically prevents any HTML output if there are no items...
|
810 |
-
$instance['hide_empty'] = $instance['hide_empty'] && $this->cmw_wp_version('3.6');
|
811 |
-
|
812 |
//allow a filter to amend the instance settings prior to producing the widget output...
|
813 |
//eg. add_filter( 'custom_menu_wizard_settings_pre_widget', [filter_function], 10, 2 ) => $instance (array)
|
814 |
$instance = apply_filters( 'custom_menu_wizard_settings_pre_widget', $instance, $this->id_base );
|
@@ -872,9 +809,6 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
872 |
|
873 |
//add my filters...
|
874 |
add_filter('custom_menu_wizard_walker_items', array( $this, 'cmw_filter_walker_items' ), 10, 2);
|
875 |
-
if( $instance['hide_empty'] ){
|
876 |
-
add_filter( "wp_nav_menu_{$menu->slug}_items", array( $this, 'cmw_filter_check_for_no_items' ), 65532, 2 );
|
877 |
-
}
|
878 |
|
879 |
//allow a filter to amend the wp_nav_menu() params prior to calling it...
|
880 |
//eg. add_filter( 'custom_menu_wizard_nav_params', [filter_function], 10, 3 ) => $params (array)
|
@@ -883,9 +817,6 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
883 |
|
884 |
//remove my filters...
|
885 |
remove_filter('custom_menu_wizard_walker_items', array( $this, 'cmw_filter_walker_items' ), 10, 2);
|
886 |
-
if( $instance['hide_empty'] ){
|
887 |
-
remove_filter( "wp_nav_menu_{$menu->slug}_items", array( $this, 'cmw_filter_check_for_no_items' ), 65532, 2 );
|
888 |
-
}
|
889 |
|
890 |
//only put something out if there is something to put out...
|
891 |
if( !empty( $out ) ){
|
@@ -977,9 +908,7 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
977 |
//don't really need to worry about the id for non-javascript enabled usage because the css hides the
|
978 |
//button, but it doesn't hurt so I've left it in...
|
979 |
$hashid = $this->get_field_id( 'cmw' . ++$this->_cmw_hash_ct );
|
980 |
-
?>
|
981 |
-
<a class="widget-<?php echo $this->id_base; ?>-assist button" id="<?php echo $hashid; ?>" href="#<?php echo $hashid; ?>"><?php _e('assist', 'custom-menu-wizard'); ?></a>
|
982 |
-
<?php
|
983 |
|
984 |
}
|
985 |
|
@@ -1031,49 +960,6 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1031 |
|
1032 |
}
|
1033 |
|
1034 |
-
/**
|
1035 |
-
* this gets run (filter: wp_nav_menu_{$menu->slug}_items) if hide_empty is set
|
1036 |
-
* if $items is empty then add a wp_nav_menu filter to do the actual return of an empty string
|
1037 |
-
* it gets run before the wp_nav_menu filter, but it gets the $items array whereas the wp_nav_menu filter does not
|
1038 |
-
* it gets added by $this->widget() before wp_nav_menu() is called, and removed immediately after wp_nav_menu() returns
|
1039 |
-
*
|
1040 |
-
* v1.1.0 As of WP v3.6 this method becomes superfluous because wp_nav_menu() has had code added to immediately
|
1041 |
-
* cop out (return false) if the output from wp_nav_menu_{$menu->slug}_items filter(s) is empty.
|
1042 |
-
* However, it stays in so as to cope with versions < 3.6
|
1043 |
-
*
|
1044 |
-
* @param array $items Menu items
|
1045 |
-
* @param object $args
|
1046 |
-
* @return array Menu items
|
1047 |
-
*/
|
1048 |
-
public function cmw_filter_check_for_no_items($items, $args){
|
1049 |
-
|
1050 |
-
if( !empty( $args->_custom_menu_wizard ) && empty( $items ) ){
|
1051 |
-
add_filter( 'wp_nav_menu', array( $this, 'cmw_filter_no_output_when_empty' ), 65532, 2 );
|
1052 |
-
}
|
1053 |
-
return $items;
|
1054 |
-
|
1055 |
-
} //end cmw_filter_check_for_no_items()
|
1056 |
-
|
1057 |
-
/**
|
1058 |
-
* this (filter: wp_nav_menu) merely removes itself from the filters and returns an empty string
|
1059 |
-
* it gets added by the cmw_filter_check_for_no_items method below, and only
|
1060 |
-
* ever gets run when hide_empty is set on the widget instance
|
1061 |
-
*
|
1062 |
-
* v1.1.0 As of WP v3.6 this method becomes superfluous because wp_nav_menu() has had code added to immediately
|
1063 |
-
* cop out (return false) if the output from wp_nav_menu_{$menu->slug}_items filter(s) is empty.
|
1064 |
-
* However, it stays in so as to cope with versions < 3.6
|
1065 |
-
*
|
1066 |
-
* @param string $nav_menu HTML for the menu
|
1067 |
-
* @param object $args
|
1068 |
-
* @return string HTML for the menu
|
1069 |
-
*/
|
1070 |
-
public function cmw_filter_no_output_when_empty($nav_menu, $args){
|
1071 |
-
|
1072 |
-
remove_filter( 'wp_nav_menu', array( $this, __FUNCTION__ ), 65532, 2 );
|
1073 |
-
return empty( $args->_custom_menu_wizard ) ? $nav_menu : '';
|
1074 |
-
|
1075 |
-
} //end cmw_filter_no_output_when_empty()
|
1076 |
-
|
1077 |
/**
|
1078 |
* v1.2.1 stores any walker-determined information back into the widget instance
|
1079 |
* gets run by the walker, on the filtered array of menu items, just before running parent::walk()
|
@@ -1105,17 +991,18 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1105 |
$fieldClass = empty( $params['fclass'] ) ? '' : $params['fclass'];
|
1106 |
$disabling = !empty( $labelClass ) && isset( $params['disableif'] );
|
1107 |
?>
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
<?php
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
|
|
1119 |
|
1120 |
} // end cmw_formfield_checkbox()
|
1121 |
|
@@ -1130,21 +1017,17 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1130 |
|
1131 |
$fieldClass = empty( $params['fclass'] ) ? '' : $params['fclass'];
|
1132 |
|
1133 |
-
if( !empty( $params['label'] ) )
|
1134 |
-
|
1135 |
-
|
1136 |
-
<?php
|
1137 |
-
|
1138 |
-
?>
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
?>
|
1145 |
-
<span class="cmw-small-block"><em class="cmw-colour-grey"><?php echo $params['desc']; ?></em></span>
|
1146 |
-
<?php
|
1147 |
-
}
|
1148 |
|
1149 |
} // end cmw_formfield_textbox()
|
1150 |
|
@@ -1245,12 +1128,13 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1245 |
$selected = selected( $selectedItem, $item->ID, false );
|
1246 |
if( !empty( $selected ) ){
|
1247 |
$rtn['selectedBranchName'] = $title;
|
|
|
1248 |
}
|
1249 |
-
$rtn['selectedOptgroup'][ $sogCt ] .= '<option value="' . $item->ID . '" ' . $selected . '
|
1250 |
$rtn['selectedOptgroup'][ $sogCt ] .= str_repeat( ' ', ($level - 1) * 3 ) . esc_attr( $title ) . '</option>';
|
1251 |
}
|
1252 |
//don't set "selected" on the big list...
|
1253 |
-
$menuGrpOpts .= '<option value="' . $item->ID . '" data-cmw-level="' . $level . '">';
|
1254 |
$menuGrpOpts .= str_repeat( ' ', ($level - 1) * 3 ) . esc_attr( $title ) . '</option>';
|
1255 |
}
|
1256 |
}
|
@@ -1307,30 +1191,17 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1307 |
|
1308 |
$hashid = $this->get_field_id( 'cmw' . ++$this->_cmw_hash_ct );
|
1309 |
?>
|
1310 |
-
|
|
|
1311 |
id="<?php echo $hashid; ?>" href="#<?php echo $hashid; ?>"><?php echo $text; ?></a>
|
1312 |
<input id="<?php echo $this->get_field_id($fname); ?>" class="cmw-display-none cmw-fieldset-state"
|
1313 |
-
name="<?php echo $this->get_field_name($fname); ?>"
|
1314 |
-
type="checkbox" value="1" <?php checked( $instance[$fname] ); ?> />
|
1315 |
<div class="cmw-fieldset<?php echo $instance[$fname] ? ' cmw-start-fieldset-collapsed' : ''; ?>">
|
|
|
1316 |
<?php
|
1317 |
|
1318 |
} //end cmw_open_a_field_section()
|
1319 |
|
1320 |
-
/**
|
1321 |
-
* returns true if the version of WP is lower-than or greater-than-or-equal to the one provided
|
1322 |
-
*
|
1323 |
-
* @param string $v Version to test for lower than
|
1324 |
-
* @return boolean
|
1325 |
-
*/
|
1326 |
-
public function cmw_wp_version( $v, $gte=false ){
|
1327 |
-
global $wp_version;
|
1328 |
-
|
1329 |
-
$rtn = version_compare( strtolower( $wp_version ), $v . 'a', '<' );
|
1330 |
-
return $gte ? !$rtn : $rtn;
|
1331 |
-
|
1332 |
-
} //end cmw_wp_version()
|
1333 |
-
|
1334 |
/**
|
1335 |
* sanitizes the widget settings for update(), widget() and form()
|
1336 |
*
|
@@ -1379,7 +1250,6 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1379 |
'title_linked' => 0, //v3.1.4 added
|
1380 |
'ol_root' => 0,
|
1381 |
'ol_sub' => 0,
|
1382 |
-
'hide_empty' => 0, //this only has relevance prior to WP v3.6
|
1383 |
//field section collapsed toggles...
|
1384 |
'fs_filters' => 1, //v3.0.0 replaces fs_filter and now starts out collapsed
|
1385 |
'fs_fallbacks' => 1,
|
@@ -1719,14 +1589,15 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1719 |
$instance = $this->cmw_legacy_settings( $instance, array(), 'form' );
|
1720 |
|
1721 |
//if no populated menus exist, suggest the user go create one...
|
1722 |
-
if( ( $menus = $this->cmw_scan_menus( $instance['menu'], $instance['filter_item'] ) ) === false )
|
1723 |
-
|
1724 |
<p class="widget-<?php echo $this->id_base; ?>-no-menus">
|
1725 |
<?php printf( wp_kses( __('No populated menus have been created yet! <a href="%s">Create one...</a>', 'custom-menu-wizard'), array('a'=>array('href'=>array())) ), admin_url('nav-menus.php') ); ?>
|
1726 |
</p>
|
|
|
1727 |
<?php
|
1728 |
return;
|
1729 |
-
|
1730 |
|
1731 |
//set up some simple booleans for use at the disableif___ classes...
|
1732 |
$isShowSpecific = $instance['filter'] < 0; // disableif-ss (IS show specific items)
|
@@ -1735,19 +1606,13 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1735 |
$isNotCurrentItem = $isNotChildrenOf || $instance['filter_item'] != 0; // disableifnot-ci (is NOT Children-of Current Item)
|
1736 |
|
1737 |
?>
|
|
|
1738 |
<div id="<?php echo $this->get_field_id('onchange'); ?>"
|
1739 |
-
class="widget-<?php echo $this->id_base; ?>-onchange
|
1740 |
-
data-cmw-
|
1741 |
-
data-cmw-dialog-prompt='<?php _e('Click an item to toggle "Current Menu Item"', 'custom-menu-wizard'); ?>'
|
1742 |
-
data-cmw-dialog-output='<?php _e('Basic Output', 'custom-menu-wizard'); ?>'
|
1743 |
-
data-cmw-dialog-fallback='<?php _e('Fallback invoked', 'custom-menu-wizard'); ?>'
|
1744 |
-
data-cmw-dialog-set-current='<?php _e('Set Current Item?', 'custom-menu-wizard'); ?>'
|
1745 |
-
data-cmw-dialog-shortcodes='<?php _e('Find posts/pages containing a CMW shortcode', 'custom-menu-wizard'); ?>'
|
1746 |
-
data-cmw-dialog-untitled='<?php _e('untitled', 'custom-menu-wizard'); ?>'
|
1747 |
-
data-cmw-dialog-fixed='<?php _e('fixed', 'custom-menu-wizard'); ?>'
|
1748 |
data-cmw-dialog-nonce='<?php echo wp_create_nonce( 'cmw-find-shortcodes' ); ?>'
|
1749 |
-
data-cmw-dialog-
|
1750 |
-
data-cmw-
|
1751 |
<?php
|
1752 |
/**
|
1753 |
* Legacy warning...
|
@@ -1759,15 +1624,16 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1759 |
<?php
|
1760 |
//allow a filter to return true, whereby updates to legacy widgets are disallowed...
|
1761 |
//eg. apply_filter( 'custom_menu_wizard_prevent_legacy_updates', [filter function], 10, 1 ) => true
|
1762 |
-
if( apply_filters( 'custom_menu_wizard_prevent_legacy_updates', false ) )
|
1763 |
?>
|
1764 |
<br /><?php _e('Any changes you make will NOT be Saved!', 'custom-menu-wizard'); ?>
|
1765 |
<?php
|
1766 |
-
|
1767 |
?>
|
1768 |
<br /><?php _e('Please consider creating a new instance of the widget to replace this one.', 'custom-menu-wizard'); ?>
|
1769 |
<a href="<?php echo $this->_cmw_legacy_warnreadmore; ?>" target="_blank"><?php _e('read more', 'custom-menu-wizard'); ?></a></em>
|
1770 |
</p>
|
|
|
1771 |
<?php
|
1772 |
|
1773 |
/**
|
@@ -1803,8 +1669,7 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1803 |
*/
|
1804 |
$this->cmw_open_a_field_section( $instance, __('Filter', 'custom-menu-wizard'), 'fs_filter' );
|
1805 |
?>
|
1806 |
-
<p
|
1807 |
-
<?php $this->cmw_assist_link(); ?>
|
1808 |
<label>
|
1809 |
<input id="<?php echo $this->get_field_id('filter'); ?>_0" class="cmw-showall cmw-listen" <?php $this->cmw_disableif(); ?>
|
1810 |
name="<?php echo $this->get_field_name('filter'); ?>" type="radio" value="0" <?php checked( $instance['filter'], 0 ); ?> />
|
@@ -1839,32 +1704,28 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1839 |
<label for="<?php echo $this->get_field_id('start_level'); ?>"><?php _e('Starting Level:', 'custom-menu-wizard'); ?></label>
|
1840 |
<select id="<?php echo $this->get_field_id('start_level'); ?>" <?php $this->cmw_disableif(); ?>
|
1841 |
class="cmw-start-level" name="<?php echo $this->get_field_name('start_level'); ?>">
|
1842 |
-
<?php for( $i = 1; $i <= $menus['selectedLevels']; $i++ )
|
1843 |
<option value="<?php echo $i; ?>" <?php selected( $instance['start_level'] > $menus['selectedLevels'] ? 1 : $instance['start_level'], $i ); ?>><?php echo $i; ?></option>
|
1844 |
-
<?php
|
1845 |
</select>
|
1846 |
<span class="cmw-small-block"><em><?php _e('Level to start testing items for inclusion', 'custom-menu-wizard'); ?></em></span>
|
1847 |
-
</p
|
1848 |
|
1849 |
<p class="cmw-disableif-ss<?php $this->cmw_disableif( 'push', $isShowSpecific ); ?>">
|
1850 |
<label for="<?php echo $this->get_field_id('depth'); ?>"><?php _e('For Depth:', 'custom-menu-wizard'); ?></label>
|
1851 |
-
<select id="<?php echo $this->get_field_id('depth'); ?>" class="cmw-depth"
|
1852 |
-
|
1853 |
<option value="0" <?php selected( $instance['depth'] > $menus['selectedLevels'] ? 0 : $instance['depth'], 0 ); ?>><?php _e('unlimited', 'custom-menu-wizard'); ?></option>
|
1854 |
-
<?php
|
1855 |
-
for( $i = 1; $i <= $menus['selectedLevels']; $i++ ){
|
1856 |
-
?>
|
1857 |
<option value="<?php echo $i; ?>" <?php selected( $instance['depth'], $i ); ?>><?php printf( _n('%d level', '%d levels', $i, 'custom-menu-wizard'), $i ); ?></option>
|
1858 |
-
<?php
|
1859 |
-
}
|
1860 |
-
?>
|
1861 |
</select>
|
1862 |
<span class="cmw-small-block"><em><?php _e('Relative to first Filter item found, <strong>unless</strong>…', 'custom-menu-wizard'); ?></em></span>
|
1863 |
<?php $this->cmw_formfield_checkbox( $instance, 'depth_rel_current',
|
1864 |
array(
|
1865 |
'label' => __('Relative to Current Item <small><em>(if found)</em></small>', 'custom-menu-wizard')
|
1866 |
) ); ?>
|
1867 |
-
</p
|
1868 |
|
1869 |
<?php $this->cmw_close_a_field_section(); ?>
|
1870 |
|
@@ -1874,15 +1735,13 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1874 |
*/
|
1875 |
$this->cmw_open_a_field_section( $instance, __('Fallbacks', 'custom-menu-wizard'), 'fs_fallbacks' );
|
1876 |
?>
|
1877 |
-
<p class="cmw-disableifnot-rp<?php $this->cmw_disableif( 'push', $isNotCurrentRootParent ); ?>"
|
1878 |
-
<?php $this->cmw_assist_link(); ?>
|
1879 |
<span class="cmw-small-block"><strong><?php _e( 'If "Children of" is <em>Current Root / Parent Item</em>, and no ancestor exists' , 'custom-menu-wizard'); ?> :</strong></span>
|
1880 |
<?php $this->cmw_formfield_checkbox( $instance, 'fallback_no_ancestor',
|
1881 |
array(
|
1882 |
'label' => __('Switch to Current Item, and', 'custom-menu-wizard')
|
1883 |
) ); ?>
|
1884 |
-
<br
|
1885 |
-
<?php $this->cmw_formfield_checkbox( $instance, 'fallback_include_parent',
|
1886 |
array(
|
1887 |
'label' => __('Include Parent...', 'custom-menu-wizard')
|
1888 |
) ); ?>
|
@@ -1891,7 +1750,7 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1891 |
'label' => __('with Siblings', 'custom-menu-wizard'),
|
1892 |
'lclass' => 'cmw-whitespace-nowrap'
|
1893 |
) ); ?>
|
1894 |
-
</p
|
1895 |
|
1896 |
<p class="cmw-disableifnot-ci<?php $this->cmw_disableif( 'push', $isNotCurrentItem ); ?>">
|
1897 |
<span class="cmw-small-block"><strong><?php _e( 'If "Children of" is <em>Current Item</em>, and current item has no children' , 'custom-menu-wizard'); ?> :</strong></span>
|
@@ -1909,7 +1768,7 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1909 |
'label' => __('with Siblings', 'custom-menu-wizard'),
|
1910 |
'lclass' => 'cmw-whitespace-nowrap'
|
1911 |
) ); ?>
|
1912 |
-
</p
|
1913 |
|
1914 |
<?php $this->cmw_close_a_field_section(); ?>
|
1915 |
|
@@ -1919,8 +1778,7 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1919 |
*/
|
1920 |
$this->cmw_open_a_field_section( $instance, __('Output', 'custom-menu-wizard'), 'fs_output' );
|
1921 |
?>
|
1922 |
-
<p
|
1923 |
-
<?php $this->cmw_assist_link(); ?>
|
1924 |
<label>
|
1925 |
<input id="<?php echo $this->get_field_id('flat_output'); ?>_0" name="<?php echo $this->get_field_name('flat_output'); ?>"
|
1926 |
type="radio" value="0" <?php checked(!$instance['flat_output']); ?> <?php $this->cmw_disableif(); ?> />
|
@@ -1949,18 +1807,16 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1949 |
'label' => __('with Siblings', 'custom-menu-wizard'),
|
1950 |
'lclass' => 'cmw-whitespace-nowrap'
|
1951 |
) ); ?>
|
1952 |
-
<br
|
1953 |
-
<?php $this->cmw_formfield_checkbox( $instance, 'include_ancestors',
|
1954 |
array(
|
1955 |
'label' => __('Include Ancestors', 'custom-menu-wizard')
|
1956 |
) ); ?>
|
1957 |
-
<br
|
1958 |
-
<?php $this->cmw_formfield_checkbox( $instance, 'title_from_parent',
|
1959 |
array(
|
1960 |
'label' => __('Title from Parent', 'custom-menu-wizard'),
|
1961 |
'desc' => __('Only if the "Children of" Filter returns items', 'custom-menu-wizard')
|
1962 |
) ); ?>
|
1963 |
-
</p
|
1964 |
|
1965 |
<p>
|
1966 |
<?php $this->cmw_formfield_checkbox( $instance, 'title_from_current',
|
@@ -1972,8 +1828,7 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1972 |
|
1973 |
<p>
|
1974 |
<?php _e('Change UL to OL:', 'custom-menu-wizard'); ?>
|
1975 |
-
<br
|
1976 |
-
<?php $this->cmw_formfield_checkbox( $instance, 'ol_root',
|
1977 |
array(
|
1978 |
'label' => __('Top Level', 'custom-menu-wizard')
|
1979 |
) ); ?>
|
@@ -1984,24 +1839,6 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1984 |
) ); ?>
|
1985 |
</p>
|
1986 |
|
1987 |
-
<?php
|
1988 |
-
//v1.1.0 As of WP v3.6, wp_nav_menu() automatically cops out (without outputting any HTML) if there are no items,
|
1989 |
-
// so the hide_empty option becomes superfluous; however, I'll keep the previous setting (if there was one)
|
1990 |
-
// in case of reversion to an earlier version of WP...
|
1991 |
-
if( $this->cmw_wp_version('3.6') ){
|
1992 |
-
?>
|
1993 |
-
<p>
|
1994 |
-
<?php $this->cmw_formfield_checkbox( $instance, 'hide_empty',
|
1995 |
-
array(
|
1996 |
-
'label' => __('Hide Widget if Empty', 'custom-menu-wizard'),
|
1997 |
-
'desc' => __('Prevents any output when no items are found', 'custom-menu-wizard')
|
1998 |
-
) ); ?>
|
1999 |
-
</p>
|
2000 |
-
<?php }else{ ?>
|
2001 |
-
<input id="<?php echo $this->get_field_id('hide_empty'); ?>" name="<?php echo $this->get_field_name('hide_empty'); ?>"
|
2002 |
-
type="hidden" value="<?php echo $instance['hide_empty'] ? '1' : ''; ?>" />
|
2003 |
-
<?php } ?>
|
2004 |
-
|
2005 |
<?php $this->cmw_close_a_field_section(); ?>
|
2006 |
|
2007 |
<?php
|
@@ -2130,7 +1967,6 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
2130 |
'include_parent' => 0,
|
2131 |
'include_parent_siblings' => 0, //v1.1.0 added
|
2132 |
'include_ancestors' => 0,
|
2133 |
-
'hide_empty' => 0, //v1.1.0: this now only has relevance prior to WP v3.6
|
2134 |
'title_from_parent' => 0,
|
2135 |
'title_from_current' => 0, //v1.2.0 added
|
2136 |
'ol_root' => 0,
|
@@ -2275,9 +2111,6 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
2275 |
//sanitize $instance...
|
2276 |
$instance = $this->cmw_legacy_settings( $instance, array(), 'widget' );
|
2277 |
|
2278 |
-
//v1.1.0 As of WP v3.6, wp_nav_menu() automatically prevents any HTML output if there are no items...
|
2279 |
-
$instance['hide_empty'] = $instance['hide_empty'] && $this->cmw_wp_version('3.6');
|
2280 |
-
|
2281 |
//allow a filter to amend the instance settings prior to producing the widget output...
|
2282 |
//eg. add_filter( 'custom_menu_wizard_settings_pre_widget', [filter_function], 10, 2 ) => $instance (array)
|
2283 |
$instance = apply_filters( 'custom_menu_wizard_settings_pre_widget', $instance, $this->id_base );
|
@@ -2338,9 +2171,6 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
2338 |
}
|
2339 |
|
2340 |
add_filter('custom_menu_wizard_walker_items', array( $this, 'cmw_filter_walker_items' ), 10, 2);
|
2341 |
-
if( $instance['hide_empty'] ){
|
2342 |
-
add_filter( "wp_nav_menu_{$menu->slug}_items", array( $this, 'cmw_filter_check_for_no_items' ), 65532, 2 );
|
2343 |
-
}
|
2344 |
|
2345 |
//allow a filter to amend the wp_nav_menu() params prior to calling it...
|
2346 |
//eg. add_filter( 'custom_menu_wizard_nav_params', [filter_function], 10, 3 ) => $params (array)
|
@@ -2348,9 +2178,6 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
2348 |
$out = wp_nav_menu( apply_filters( 'custom_menu_wizard_nav_params', $params, $instance, $this->id_base ) );
|
2349 |
|
2350 |
remove_filter('custom_menu_wizard_walker_items', array( $this, 'cmw_filter_walker_items' ), 10, 2);
|
2351 |
-
if( $instance['hide_empty'] ){
|
2352 |
-
remove_filter( "wp_nav_menu_{$menu->slug}_items", array( $this, 'cmw_filter_check_for_no_items' ), 65532, 2 );
|
2353 |
-
}
|
2354 |
|
2355 |
//only put something out if there is something to put out...
|
2356 |
if( !empty( $out ) ){
|
17 |
array(
|
18 |
'classname' => 'widget_custom_menu_wizard',
|
19 |
'description' => __('Add a custom menu, or part of one, as a widget', 'custom-menu-wizard'),
|
20 |
+
//opt in to support for Selective Refresh for Widgets (in Customizer, WordPress 4.5), and
|
21 |
+
//remove support for Widget Customizer plugin (since it's in core from WordPress 3.9)...
|
22 |
+
//NB selective refresh has to be opted-in by the theme as well, for it to have any effect.
|
23 |
+
'customize_selective_refresh' => true
|
24 |
)
|
25 |
);
|
26 |
$this->_cmw_legacy_warnreadmore = 'http://wordpress.org/plugins/' . $this->id_base . '/changelog/';
|
67 |
$instance = self::cmw_settings( $instance, array(), __FUNCTION__ );
|
68 |
|
69 |
//if no populated menus exist, suggest the user go create one...
|
70 |
+
if( ( $menus = $this->cmw_scan_menus( $instance['menu'], $instance['branch'] ) ) === false ) : ?>
|
71 |
+
|
72 |
<p class="widget-<?php echo $this->id_base; ?>-no-menus">
|
73 |
+
<em><?php printf(
|
74 |
+
wp_kses(
|
75 |
+
__( 'No populated menus have been created yet! <a href="%s">Create one...</a>', 'custom-menu-wizard' ),
|
76 |
+
array('a'=>array('href'=>array()))
|
77 |
+
),
|
78 |
+
esc_attr(
|
79 |
+
isset( $GLOBALS['wp_customize'] ) && $GLOBALS['wp_customize'] instanceof WP_Customize_Manager
|
80 |
+
? 'javascript: wp.customize.panel( "nav_menus" ).focus();'
|
81 |
+
: admin_url('nav-menus.php')
|
82 |
+
)
|
83 |
+
); ?></em>
|
84 |
<input id="<?php echo $this->get_field_id('cmwv'); ?>" name="<?php echo $this->get_field_name('cmwv'); ?>"
|
85 |
type="hidden" value="<?php echo Custom_Menu_Wizard_Plugin::$version; ?>" />
|
86 |
+
<?php foreach( array('filters', 'fallbacks', 'output', 'container', 'classes', 'links') as $v ) : ?>
|
87 |
<input id="<?php echo $this->get_field_id("fs_$v"); ?>" name="<?php echo $this->get_field_name("fs_$v"); ?>"
|
88 |
type="hidden" value="<?php echo $instance["fs_$v"] ? '1' : '0' ?>" />
|
89 |
+
<?php endforeach; ?>
|
90 |
</p>
|
91 |
<?php
|
92 |
//all done : quit...
|
93 |
return;
|
94 |
+
endif;
|
95 |
|
96 |
//create the OPTIONs for the relative & absolute optgroups in the branch level select...
|
97 |
$absGroup = array();
|
147 |
|
148 |
//NB the 'onchange' wrapper holds any text required by the "assist"
|
149 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
|
151 |
+
<div id="<?php echo $this->get_field_id('onchange'); ?>"
|
152 |
+
class="widget-<?php echo $this->id_base; ?>-onchange"
|
153 |
+
data-cmw-instance-version='<?php echo Custom_Menu_Wizard_Plugin::$version; ?>'
|
154 |
+
data-cmw-dialog-nonce='<?php echo wp_create_nonce( 'cmw-find-shortcodes' ); ?>'
|
155 |
+
data-cmw-dialog-id='<?php echo $this->get_field_id('dialog'); ?>'>
|
156 |
<?php
|
157 |
/**
|
158 |
* permanently visible section : Title (with Hide) and Menu
|
159 |
*/
|
160 |
?>
|
161 |
+
|
162 |
<p>
|
163 |
+
<input type="hidden" value="<?php echo Custom_Menu_Wizard_Plugin::$version; ?>"
|
164 |
+
id="<?php echo $this->get_field_id('cmwv'); ?>" name="<?php echo $this->get_field_name('cmwv'); ?>" />
|
165 |
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'custom-menu-wizard') ?></label>
|
166 |
+
<?php $this->cmw_formfield_checkbox( $instance, 'hide_title',
|
167 |
array(
|
168 |
'label' => _x('Hide', 'verb', 'custom-menu-wizard'),
|
169 |
'lclass' => 'alignright'
|
170 |
) ); ?>
|
171 |
+
<?php $this->cmw_formfield_textbox( $instance, 'title',
|
172 |
array(
|
173 |
'fclass' => 'widefat cmw-widget-title'
|
174 |
) ); ?>
|
176 |
|
177 |
<p>
|
178 |
<label for="<?php echo $this->get_field_id('menu'); ?>"><?php _e('Select Menu:', 'custom-menu-wizard'); ?></label>
|
179 |
+
<select id="<?php echo $this->get_field_id('menu'); ?>" class="cmw-select-menu cmw-listen"
|
180 |
+
name="<?php echo $this->get_field_name('menu'); ?>"><?php echo $menus['names']; ?></select>
|
|
|
|
|
181 |
</p>
|
|
|
182 |
<?php
|
183 |
/**
|
184 |
* start collapsible section : 'Filter'
|
185 |
*/
|
186 |
$this->cmw_open_a_field_section( $instance, __('Filters', 'custom-menu-wizard'), 'fs_filters' ); ?>
|
187 |
|
188 |
+
<div><?php $this->cmw_assist_link(); ?><strong><?php _e('Primary Filter', 'custom-menu-wizard'); ?></strong>
|
|
|
|
|
189 |
|
190 |
<div class="cmw-indented">
|
191 |
<label class="cmw-verticalalign-baseline">
|
192 |
+
<input type="radio" <?php checked( $instance['filter'], '' ); ?> value=""
|
193 |
+
id="<?php echo $this->get_field_id('filter'); ?>_0" class="cmw-bylevel cmw-listen"
|
194 |
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('filter'); ?>"
|
|
|
195 |
/><?php _e('Level:', 'custom-menu-wizard'); ?></label>
|
196 |
<select id="<?php echo $this->get_field_id('level'); ?>" class="cmw-level cmw-set-levels cmw-listen"
|
197 |
+
<?php $this->cmw_disableif(); ?> data-cmw-set-levels="0"
|
198 |
+
name="<?php echo $this->get_field_name('level'); ?>"><?php
|
199 |
+
for( $i = 1, $j = $instance['level'] > $menus['selectedLevels'] ? 1 : $instance['level']; $i <= $menus['selectedLevels']; $i++ ) :
|
200 |
+
?><option value="<?php echo $i; ?>" <?php selected( $j, $i ); ?>><?php echo $i > 1 ? $i : __('1 (root)', 'custom-menu-wizard'); ?></option><?php
|
201 |
+
endfor; ?></select>
|
202 |
+
|
203 |
</div>
|
204 |
|
205 |
<div class="cmw-indented">
|
206 |
<label class="cmw-verticalalign-baseline">
|
207 |
+
<input type="radio" <?php checked( $instance['filter'], 'branch' ); ?> value="branch"
|
208 |
+
id="<?php echo $this->get_field_id('filter'); ?>_1" class="cmw-bybranch cmw-listen"
|
209 |
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('filter'); ?>"
|
|
|
210 |
/><?php _e('Branch:', 'custom-menu-wizard'); ?></label>
|
211 |
<select id="<?php echo $this->get_field_id('branch'); ?>" class="cmw-branches cmw-assist-items cmw-listen"
|
212 |
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('branch'); ?>">
|
213 |
<option value="0" <?php selected( $instance['branch'], 0 ); ?>><?php _e('Current Item', 'custom-menu-wizard'); ?></option>
|
214 |
+
<?php echo $menus['selectedOptgroup']; ?></select>
|
215 |
+
<select id="<?php echo $this->get_field_id('branch_ignore'); ?>" class='cmw-off-the-page'
|
216 |
+
name="<?php echo $this->get_field_name('branch_ignore'); ?>" disabled="disabled">
|
217 |
+
<?php echo $menus['optgroups']; ?></select>
|
218 |
+
|
|
|
219 |
</div>
|
220 |
|
221 |
<div class="cmw-indented">
|
222 |
<label class="cmw-verticalalign-baseline">
|
223 |
+
<input type="radio" <?php checked( $instance['filter'], 'items' ); ?> value="items"
|
224 |
+
id="<?php echo $this->get_field_id('filter'); ?>_2" class="cmw-byitems cmw-listen"
|
225 |
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('filter'); ?>"
|
|
|
226 |
/><?php _e('Items:', 'custom-menu-wizard'); ?></label>
|
227 |
<?php $this->cmw_formfield_textbox( $instance, 'items',
|
228 |
array(
|
231 |
</div>
|
232 |
</div>
|
233 |
|
234 |
+
<div class="cmw-disableif-ss<?php $this->cmw_disableif( 'push', $isByItems ); ?>"><?php $this->cmw_assist_link(); ?><strong><?php _e('Secondary Filter', 'custom-menu-wizard'); ?></strong>
|
|
|
|
|
235 |
|
236 |
<div class="cmw-indented">
|
237 |
<label class="cmw-disableifnot-br<?php $this->cmw_disableif( 'push', $isNotByBranch ); ?>"><?php _e('Starting at:', 'custom-menu-wizard'); ?>
|
238 |
+
|
239 |
<select id="<?php echo $this->get_field_id('branch_start'); ?>" class="cmw-branch-start cmw-listen"
|
240 |
+
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('branch_start'); ?>">
|
241 |
+
<optgroup label="<?php _ex('relative...', 'adjective: cf. absolute', 'custom-menu-wizard'); ?>">
|
242 |
+
<?php echo implode( '', $relGroup ); ?></optgroup>
|
|
|
|
|
243 |
<optgroup label="<?php _e('absolute...', 'custom-menu-wizard'); ?>">
|
244 |
+
<?php echo implode( '', $absGroup ); ?></optgroup>
|
245 |
+
</select></label><?php $this->cmw_disableif( 'pop' ); ?><!-- end .cmw-disableifnot-br -->
|
|
|
246 |
|
247 |
+
<br /><span class="cmw-disableifnot-br<?php $this->cmw_disableif( 'push', $isNotByBranch ); ?>">
|
|
|
248 |
<label class="cmw-followed-by">
|
249 |
+
<input type="radio" <?php checked( $instance['start_mode'] !== 'level' ); ?> value=""
|
250 |
+
id="<?php echo $this->get_field_id('start_mode'); ?>_0"
|
251 |
+
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('start_mode'); ?>"
|
252 |
/><?php _e('Item <small>(if possible)</small>', 'custom-menu-wizard'); ?></label>
|
253 |
|
254 |
<label class="cmw-followed-by cmw-whitespace-nowrap">
|
255 |
+
<input type="radio" <?php checked( $instance['start_mode'] === 'level' ); ?> value="level"
|
256 |
+
id="<?php echo $this->get_field_id('start_mode'); ?>_1"
|
257 |
+
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('start_mode'); ?>"
|
258 |
/><?php _e('Level', 'custom-menu-wizard'); ?></label>
|
259 |
+
<?php $this->cmw_formfield_checkbox( $instance, 'allow_all_root',
|
|
|
260 |
array(
|
261 |
'label' => __('Allow all Root Items', 'custom-menu-wizard'),
|
262 |
'lclass' => 'cmw-whitespace-nowrap'
|
263 |
) ); ?>
|
264 |
+
</span><?php $this->cmw_disableif( 'pop' ); ?><!-- end .cmw-disableifnot-br -->
|
265 |
</div>
|
266 |
|
267 |
<div class="cmw-indented">
|
268 |
<label class="cmw-followed-by"><?php _e('For Depth:', 'custom-menu-wizard'); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
|
270 |
+
<select id="<?php echo $this->get_field_id('depth'); ?>"
|
271 |
+
name="<?php echo $this->get_field_name('depth'); ?>" data-cmw-set-levels="1"
|
272 |
+
<?php $this->cmw_disableif(); ?> class="cmw-depth cmw-set-levels cmw-listen">
|
273 |
+
<option value="0" <?php selected( $instance['depth'] > $menus['selectedLevels'] ? 0 : $instance['depth'], 0 ); ?>><?php _e('unlimited', 'custom-menu-wizard'); ?></option><?php
|
274 |
+
for( $i = 1; $i <= $menus['selectedLevels']; $i++ ) :
|
275 |
+
?><option value="<?php echo $i; ?>" <?php selected( $instance['depth'], $i ); ?>><?php printf( _n('%d level', '%d levels', $i, 'custom-menu-wizard'), $i ); ?></option><?php
|
276 |
+
endfor; ?></select></label>
|
277 |
|
278 |
+
<?php $this->cmw_formfield_checkbox( $instance, 'depth_rel_current',
|
279 |
array(
|
280 |
'label' => __('Relative to Current Item', 'custom-menu-wizard'),
|
281 |
'lclass' => 'cmw-disableif-ud cmw-whitespace-nowrap',
|
282 |
'disableif' => $isUnlimitedDepth
|
283 |
) ); ?>
|
284 |
</div>
|
285 |
+
</div><?php $this->cmw_disableif( 'pop' ); ?><!-- end .cmw-disableif-ss -->
|
286 |
|
287 |
+
<div><?php $this->cmw_assist_link(); ?><strong><?php _e('Inclusions', 'custom-menu-wizard'); ?></strong>
|
|
|
|
|
288 |
|
289 |
<div class="cmw-indented">
|
290 |
<label class="cmw-disableifnot-br<?php $this->cmw_disableif( 'push', $isNotByBranch ); ?>"><?php _e('Branch Ancestors:', 'custom-menu-wizard'); ?>
|
291 |
+
|
292 |
+
<select name="<?php echo $this->get_field_name('ancestors'); ?>"
|
293 |
+
<?php $this->cmw_disableif(); ?> id="<?php echo $this->get_field_id('ancestors'); ?>"
|
294 |
+
class="cmw-ancestors cmw-set-rel-abs-levels cmw-listen">
|
295 |
<option value="0" <?php selected( $j, 0 ); ?>> </option>
|
296 |
+
<?php
|
297 |
+
$j = $instance['ancestors'];
|
298 |
+
$j = max( min( $j, $menus['selectedLevels'] - 1 ), 1 - $menus['selectedLevels'] ); ?>
|
299 |
+
<optgroup label="<?php _ex('relative...', 'adjective: cf. absolute', 'custom-menu-wizard'); ?>">
|
300 |
+
<option value="-1" <?php selected( $j, -1 ); ?>><?php _e('-1 level (parent)', 'custom-menu-wizard'); ?></option><?php
|
301 |
+
for( $i = -2; $i > 0 - $menus['selectedLevels']; $i-- ) :
|
302 |
+
?><option value="<?php echo $i; ?>" <?php selected( $j, $i ); ?>><?php printf( __('%d levels', 'custom-menu-wizard'), $i ); ?></option><?php
|
303 |
+
endfor; ?></optgroup>
|
304 |
+
<optgroup label="<?php _e('absolute...', 'custom-menu-wizard'); ?>">
|
305 |
+
<option value="1" <?php selected( $j, 1 ); ?>><?php _e('to level 1 (root)', 'custom-menu-wizard'); ?></option><?php
|
306 |
+
for( $i = 2; $i < $menus['selectedLevels']; $i++ ) :
|
307 |
+
?><option value="<?php echo $i; ?>" <?php selected( $j, $i ); ?>><?php printf( __('to level %d', 'custom-menu-wizard'), $i ); ?></option><?php
|
308 |
+
endfor; ?></optgroup>
|
309 |
+
</select></label><?php $this->cmw_disableif( 'pop' ); ?><!-- end .cmw-disableifnot-br -->
|
310 |
+
|
311 |
+
<br /><span class="cmw-disableifnot-br<?php $this->cmw_disableif( 'push', $isNotByBranch ); ?>">
|
|
|
|
|
|
|
312 |
<label><?php _e('... with Siblings:', 'custom-menu-wizard'); ?>
|
313 |
+
|
314 |
<select id="<?php echo $this->get_field_id('ancestor_siblings'); ?>" class="cmw-ancestor-siblings cmw-set-rel-abs-levels cmw-listen"
|
315 |
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('ancestor_siblings'); ?>">
|
316 |
<option value="0" <?php selected( $j, 0 ); ?>> </option>
|
317 |
+
<?php
|
318 |
+
$j = $instance['ancestor_siblings'];
|
319 |
+
$j = max( min( $j, $menus['selectedLevels'] - 1 ), 1 - $menus['selectedLevels'] ); ?>
|
320 |
+
<optgroup label="<?php _ex('relative...', 'adjective: cf. absolute', 'custom-menu-wizard'); ?>">
|
321 |
+
<option value="-1" <?php selected( $j, -1 ); ?>><?php _e('-1 level (parent)', 'custom-menu-wizard'); ?></option><?php
|
322 |
+
for( $i = -2; $i > 0 - $menus['selectedLevels']; $i-- ) :
|
323 |
+
?><option value="<?php echo $i; ?>" <?php selected( $j, $i ); ?>><?php printf( __('%d levels', 'custom-menu-wizard'), $i ); ?></option><?php
|
324 |
+
endfor; ?></optgroup>
|
325 |
+
<optgroup label="<?php _e('absolute...', 'custom-menu-wizard'); ?>">
|
326 |
+
<option value="1" <?php selected( $j, 1 ); ?>><?php _e('to level 1 (root)', 'custom-menu-wizard'); ?></option><?php
|
327 |
+
for( $i = 2; $i < $menus['selectedLevels']; $i++ ) :
|
328 |
+
?><option value="<?php echo $i; ?>" <?php selected( $j, $i ); ?>><?php printf( __('to level %d', 'custom-menu-wizard'), $i ); ?></option><?php
|
329 |
+
endfor; ?></optgroup>
|
|
|
|
|
330 |
</select></label>
|
331 |
+
</span><?php $this->cmw_disableif( 'pop' ); ?><!-- end .cmw-disableifnot-br -->
|
332 |
</div>
|
333 |
|
334 |
+
<?php $this->cmw_formfield_checkbox( $instance, 'siblings',
|
335 |
array(
|
336 |
'label' => __('Branch Siblings', 'custom-menu-wizard'),
|
337 |
'lclass' => 'cmw-disableifnot-br',
|
340 |
|
341 |
<div class="cmw-indented">
|
342 |
<label><?php _e('Level:', 'custom-menu-wizard'); ?>
|
343 |
+
|
344 |
<select id="<?php echo $this->get_field_id('include_level'); ?>" class="cmw-include-level"
|
345 |
name="<?php echo $this->get_field_name('include_level'); ?>">
|
346 |
+
<?php $j = intval($instance['include_level']) > $menus['selectedLevels'] ? '' : $instance['include_level']; ?>
|
347 |
+
<option value="" <?php selected( $j, '' ); ?>> </option><?php
|
348 |
+
for( $i = 1; $i <= $menus['selectedLevels']; $i++ ) :
|
349 |
+
?><option value="<?php echo $i; ?>" <?php selected( $j, "$i" ); ?>><?php echo $i; ?></option><?php
|
350 |
+
?><option value="<?php echo $i . '-'; ?>" <?php selected( $j, $i . '-' ); ?>> <?php echo "$i " . __('and above', 'custom-menu-wizard'); ?></option><?php
|
351 |
+
?><option value="<?php echo $i . '+'; ?>" <?php selected( $j, $i . '+' ); ?>> <?php echo "$i " . __('and below', 'custom-menu-wizard'); ?></option><?php
|
352 |
+
endfor; ?></select></label>
|
|
|
353 |
</div>
|
354 |
</div>
|
355 |
|
356 |
+
<div><?php $this->cmw_assist_link(); ?><strong><?php _e('Exclusions', 'custom-menu-wizard'); ?></strong>
|
|
|
|
|
357 |
|
358 |
<div class="cmw-indented">
|
359 |
+
<?php $this->cmw_formfield_textbox( $instance, 'exclude',
|
360 |
array(
|
361 |
'label' => __('Item Ids:', 'custom-menu-wizard'),
|
362 |
'fclass' => 'cmw-maxwidth-twothirds cmw-exclusions'
|
365 |
|
366 |
<div class="cmw-indented">
|
367 |
<label><?php _e('Level:', 'custom-menu-wizard'); ?>
|
368 |
+
|
369 |
<select id="<?php echo $this->get_field_id('exclude_level'); ?>" class="cmw-exclude-level"
|
370 |
name="<?php echo $this->get_field_name('exclude_level'); ?>">
|
371 |
+
<?php $j = intval($instance['exclude_level']) > $menus['selectedLevels'] ? '' : $instance['exclude_level']; ?>
|
372 |
+
<option value="" <?php selected( $j, '' ); ?>> </option><?php
|
373 |
+
for( $i = 1; $i <= $menus['selectedLevels']; $i++ ) :
|
374 |
+
?><option value="<?php echo $i; ?>" <?php selected( $j, "$i" ); ?>><?php echo $i; ?></option><?php
|
375 |
+
?><option value="<?php echo $i . '-'; ?>" <?php selected( $j, $i . '-' ); ?>> <?php echo "$i " . __('and above', 'custom-menu-wizard'); ?></option><?php
|
376 |
+
?><option value="<?php echo $i . '+'; ?>" <?php selected( $j, $i . '+' ); ?>> <?php echo "$i " . __('and below', 'custom-menu-wizard'); ?></option><?php
|
377 |
+
endfor; ?></select></label>
|
|
|
378 |
</div>
|
379 |
</div>
|
380 |
|
381 |
+
<div><?php $this->cmw_assist_link(); ?><strong><?php _e('Qualifier', 'custom-menu-wizard'); ?></strong>
|
|
|
|
|
382 |
<br /><label for="<?php echo $this->get_field_id('contains_current'); ?>"><?php _e('Current Item is in:', 'custom-menu-wizard'); ?></label>
|
383 |
<select id="<?php echo $this->get_field_id('contains_current'); ?>"
|
384 |
+
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('contains_current'); ?>">
|
385 |
+
<option value="" <?php selected( $instance['contains_current'], '' ); ?>> </option><?php
|
386 |
+
?><option value="menu" <?php selected( $instance['contains_current'], 'menu' ); ?>><?php echo _e('Menu', 'custom-menu-wizard'); ?></option><?php
|
387 |
+
?><option value="primary" <?php selected( $instance['contains_current'], 'primary' ); ?>><?php echo _e('Primary Filter', 'custom-menu-wizard'); ?></option><?php
|
388 |
+
?><option value="secondary" <?php selected( $instance['contains_current'], 'secondary' ); ?>><?php echo _e('Secondary Filter', 'custom-menu-wizard'); ?></option><?php
|
389 |
+
?><option value="inclusions" <?php selected( $instance['contains_current'], 'inclusions' ); ?>><?php echo _e('Inclusions', 'custom-menu-wizard'); ?></option><?php
|
390 |
+
?><option value="output" <?php selected( $instance['contains_current'], 'output' ); ?>><?php echo _e('Final Output', 'custom-menu-wizard'); ?></option>
|
391 |
</select>
|
392 |
</div>
|
393 |
|
399 |
*/
|
400 |
$this->cmw_open_a_field_section( $instance, __('Fallbacks', 'custom-menu-wizard'), 'fs_fallbacks' ); ?>
|
401 |
|
402 |
+
<div class="cmw-disableifnot-br-ci<?php $this->cmw_disableif( 'push', $isNotBranchCurrentItem ); ?>"><?php $this->cmw_assist_link(); ?>
|
|
|
403 |
|
404 |
<div class="cmw-indented">
|
405 |
<label for="<?php echo $this->get_field_id('fallback'); ?>"><strong><?php _e('If Current Item has no children:', 'custom-menu-wizard'); ?></strong></label>
|
406 |
<select id="<?php echo $this->get_field_id('fallback'); ?>" class="cmw-fallback cmw-listen"
|
407 |
+
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('fallback'); ?>">
|
408 |
+
<option value="" <?php selected( $instance['fallback'], '' ); ?>> </option><?php
|
409 |
+
?><option value="parent" <?php selected( $instance['fallback'], 'parent' ); ?>><?php _e('Start at : -1 (parent)', 'custom-menu-wizard'); ?></option><?php
|
410 |
+
?><option value="current" <?php selected( $instance['fallback'], 'current' ); ?>><?php _e('Start at : the Current Item', 'custom-menu-wizard'); ?></option><?php
|
411 |
+
?><option value="quit" <?php selected( $instance['fallback'], 'quit' ); ?>><?php _e('No output!', 'custom-menu-wizard'); ?></option>
|
412 |
</select>
|
413 |
|
414 |
+
<br /><span class="cmw-disableifnot-fb-pc<?php $this->cmw_disableif( 'push', $isNotFallbackParentCurrent ); ?>">
|
415 |
+
<?php $this->cmw_formfield_checkbox( $instance, 'fallback_siblings',
|
|
|
416 |
array(
|
417 |
'label' => '…' . __('and Include its Siblings', 'custom-menu-wizard')
|
418 |
) ); ?>
|
419 |
+
<br /><label><?php _e('For Depth:', 'custom-menu-wizard'); ?>
|
420 |
+
|
421 |
+
<select <?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('fallback_depth'); ?>"
|
422 |
+
id="<?php echo $this->get_field_id('fallback_depth'); ?>" class="cmw-set-levels"
|
423 |
+
data-cmw-set-levels="1">
|
424 |
+
<option value="0" <?php selected( $instance['fallback_depth'] > $menus['selectedLevels'] ? 0 : $instance['fallback_depth'], 0 ); ?>> </option><?php
|
425 |
+
for( $i = 1; $i <= $menus['selectedLevels']; $i++ ) :
|
426 |
+
?><option value="<?php echo $i; ?>" <?php selected( $instance['fallback_depth'], $i ); ?>><?php printf( _n('%d level', '%d levels', $i, 'custom-menu-wizard'), $i ); ?></option><?php
|
427 |
+
endfor; ?></select></label>
|
|
|
|
|
428 |
<span class="cmw-small-block cmw-indented"><em class="cmw-colour-grey"><?php _e('Fallback Depth is Relative to Current Item!', 'custom-menu-wizard'); ?></em></span>
|
429 |
+
</span><?php $this->cmw_disableif( 'pop' ); ?><!-- end .cmw-disableifnot-fb-pc -->
|
430 |
</div>
|
431 |
|
432 |
+
</div><?php $this->cmw_disableif( 'pop' ); ?><!-- end .cmw-disableifnot-br-ci -->
|
433 |
|
434 |
<div>
|
435 |
+
<div class="cmw-indented"><strong><?php _e('If no Current Item can be found:', 'custom-menu-wizard'); ?></strong><br />
|
436 |
+
<?php $this->cmw_formfield_checkbox( $instance, 'fallback_ci_parent',
|
|
|
437 |
array(
|
438 |
'label' => __('Try items marked Parent of Current', 'custom-menu-wizard')
|
439 |
) ); ?>
|
442 |
</div>
|
443 |
|
444 |
<div>
|
445 |
+
<div class="cmw-indented"><strong><?php _e('If more than 1 possible Current Item:', 'custom-menu-wizard'); ?></strong><br />
|
446 |
+
<?php $this->cmw_formfield_checkbox( $instance, 'fallback_ci_lifo',
|
|
|
447 |
array(
|
448 |
'label' => __('Use the <strong>last</strong> one found', 'custom-menu-wizard')
|
449 |
) ); ?>
|
459 |
*/
|
460 |
$this->cmw_open_a_field_section( $instance, __('Output', 'custom-menu-wizard'), 'fs_output' ); ?>
|
461 |
|
462 |
+
<div><?php $this->cmw_assist_link(); ?>
|
463 |
+
|
464 |
<label class="cmw-followed-by">
|
465 |
+
<input type="radio" <?php checked( !$instance['flat_output'] ); ?> value="0"
|
466 |
+
id="<?php echo $this->get_field_id('flat_output'); ?>_0"
|
467 |
+
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('flat_output'); ?>"
|
468 |
/><?php _e('Hierarchical', 'custom-menu-wizard'); ?></label>
|
469 |
<label class="cmw-whitespace-nowrap">
|
470 |
+
<input type="radio" <?php checked( $instance['flat_output'] ); ?> value="1"
|
471 |
+
id="<?php echo $this->get_field_id('flat_output'); ?>_1"
|
472 |
+
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('flat_output'); ?>"
|
473 |
/><?php _e('Flat', 'custom-menu-wizard'); ?></label>
|
474 |
</div>
|
475 |
|
478 |
|
479 |
<div class="cmw-indented">
|
480 |
<label><?php _e('Current Item:', 'custom-menu-wizard'); $j = $instance['title_current']; ?>
|
481 |
+
|
482 |
<select id="<?php echo $this->get_field_id('title_current'); ?>" class="cmw-title-from cmw-set-rel-abs-levels cmw-listen"
|
483 |
+
name="<?php echo $this->get_field_name('title_current'); ?>">
|
|
|
484 |
<option value="" <?php selected( $j, "" ); ?>> </option>
|
485 |
<option value="0" <?php selected( $j, "0" ); ?>><?php _e('the Current Item', 'custom-menu-wizard'); ?></option>
|
486 |
+
<?php $j = is_numeric( $j ) ? max( min( $j, $menus['selectedLevels'] - 1 ), 1 - $menus['selectedLevels'] ) : $j; ?>
|
487 |
+
<optgroup label="<?php _ex('relative...', 'adjective: cf. absolute', 'custom-menu-wizard'); ?>">
|
488 |
+
<option value="-1" <?php selected( $j, "-1" ); ?>><?php _e('-1 level (parent)', 'custom-menu-wizard'); ?></option><?php
|
489 |
+
for( $i = -2; $i > 0 - $menus['selectedLevels']; $i-- ) :
|
490 |
+
?><option value="<?php echo $i; ?>" <?php selected( $j, "$i" ); ?>><?php printf( __('%d levels', 'custom-menu-wizard'), $i ); ?></option><?php
|
491 |
+
endfor; ?></optgroup>
|
492 |
+
<optgroup label="<?php _e('absolute...', 'custom-menu-wizard'); ?>">
|
493 |
+
<option value="1" <?php selected( $j, "1" ); ?>><?php _e('level 1 (root)', 'custom-menu-wizard'); ?></option><?php
|
494 |
+
for( $i = 2; $i < $menus['selectedLevels']; $i++ ) :
|
495 |
+
?><option value="<?php echo $i; ?>" <?php selected( $j, "$i" ); ?>><?php printf( __('level %d', 'custom-menu-wizard'), $i ); ?></option><?php
|
496 |
+
endfor; ?></optgroup>
|
|
|
|
|
|
|
497 |
</select></label>
|
498 |
</div>
|
499 |
<div class="cmw-indented">
|
500 |
<label class="cmw-disableifnot-br<?php $this->cmw_disableif( 'push', $isNotByBranch ); ?>"><?php _e('Branch Item:', 'custom-menu-wizard'); $j = $instance['title_branch']; ?>
|
501 |
+
|
502 |
<select id="<?php echo $this->get_field_id('title_branch'); ?>" class="cmw-title-from cmw-set-rel-abs-levels cmw-listen"
|
503 |
+
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('title_branch'); ?>">
|
|
|
504 |
<option value="" <?php selected( $j, "" ); ?>> </option>
|
505 |
<option value="0" <?php selected( $j, "0" ); ?>><?php _e('the Branch Item', 'custom-menu-wizard'); ?></option>
|
506 |
+
<?php $j = is_numeric( $j ) ? max( min( $j, $menus['selectedLevels'] - 1 ), 1 - $menus['selectedLevels'] ) : $j; ?>
|
507 |
+
<optgroup label="<?php _ex('relative...', 'adjective: cf. absolute', 'custom-menu-wizard'); ?>">
|
508 |
+
<option value="-1" <?php selected( $j, "-1" ); ?>><?php _e('-1 level (parent)', 'custom-menu-wizard'); ?></option><?php
|
509 |
+
for( $i = -2; $i > 0 - $menus['selectedLevels']; $i-- ) :
|
510 |
+
?><option value="<?php echo $i; ?>" <?php selected( $j, "$i" ); ?>><?php printf( __('%d levels', 'custom-menu-wizard'), $i ); ?></option><?php
|
511 |
+
endfor; ?></optgroup>
|
512 |
+
<optgroup label="<?php _e('absolute...', 'custom-menu-wizard'); ?>">
|
513 |
+
<option value="1" <?php selected( $j, "1" ); ?>><?php _e('level 1 (root)', 'custom-menu-wizard'); ?></option><?php
|
514 |
+
for( $i = 2; $i < $menus['selectedLevels']; $i++ ) :
|
515 |
+
?><option value="<?php echo $i; ?>" <?php selected( $j, "$i" ); ?>><?php printf( __('level %d', 'custom-menu-wizard'), $i ); ?></option><?php
|
516 |
+
endfor; ?></optgroup>
|
517 |
+
</select></label><?php $this->cmw_disableif( 'pop' ); ?><!-- end .cmw-disableifnot-br -->
|
|
|
|
|
|
|
518 |
</div>
|
519 |
+
|
520 |
+
<div class="cmw-indented">… <?php _e('and', 'custom-menu-wizard'); ?>:
|
521 |
+
<?php $this->cmw_formfield_checkbox( $instance, 'title_linked',
|
522 |
array(
|
523 |
'label' => __('Make it a Link', 'custom-menu-wizard')
|
524 |
+
) ); ?></div>
|
|
|
525 |
</div>
|
526 |
|
527 |
+
<div><strong><?php _e('Change UL to OL', 'custom-menu-wizard'); ?></strong><br />
|
528 |
+
<?php $this->cmw_formfield_checkbox( $instance, 'ol_root',
|
|
|
|
|
529 |
array(
|
530 |
'label' => __('Top Level', 'custom-menu-wizard'),
|
531 |
'lclass' => 'cmw-followed-by'
|
532 |
) ); ?>
|
533 |
+
<?php $this->cmw_formfield_checkbox( $instance, 'ol_sub',
|
534 |
array(
|
535 |
'label' => __('Sub-Levels', 'custom-menu-wizard'),
|
536 |
'lclass' => 'cmw-whitespace-nowrap'
|
537 |
+
) ); ?></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
538 |
|
539 |
<?php $this->cmw_close_a_field_section(); ?>
|
540 |
|
544 |
*/
|
545 |
$this->cmw_open_a_field_section( $instance, __('Container', 'custom-menu-wizard'), 'fs_container' ); ?>
|
546 |
|
547 |
+
<div><?php $this->cmw_formfield_textbox( $instance, 'container',
|
|
|
548 |
array(
|
549 |
'label' => __('Element:', 'custom-menu-wizard'),
|
550 |
'desc' => __('Eg. div or nav; leave empty for no container', 'custom-menu-wizard')
|
551 |
+
) ); ?></div>
|
552 |
+
|
553 |
+
<div><?php $this->cmw_formfield_textbox( $instance, 'container_id',
|
|
|
554 |
array(
|
555 |
'label' => __('Unique ID:', 'custom-menu-wizard'),
|
556 |
'desc' => __('An optional ID for the container', 'custom-menu-wizard')
|
557 |
+
) ); ?></div>
|
558 |
+
|
559 |
+
<div><?php $this->cmw_formfield_textbox( $instance, 'container_class',
|
|
|
560 |
array(
|
561 |
'label' => __('Class:', 'custom-menu-wizard'),
|
562 |
'desc' => __('Extra class for the container', 'custom-menu-wizard')
|
563 |
+
) ); ?></div>
|
|
|
564 |
|
565 |
<?php $this->cmw_close_a_field_section(); ?>
|
566 |
|
570 |
*/
|
571 |
$this->cmw_open_a_field_section( $instance, __('Classes', 'custom-menu-wizard'), 'fs_classes' ); ?>
|
572 |
|
573 |
+
<div><?php $this->cmw_formfield_textbox( $instance, 'menu_class',
|
|
|
574 |
array(
|
575 |
'label' => __('Menu Class:', 'custom-menu-wizard'),
|
576 |
'desc' => __('Class for the list element forming the menu', 'custom-menu-wizard')
|
577 |
+
) ); ?></div>
|
578 |
+
|
579 |
+
<div><?php $this->cmw_formfield_textbox( $instance, 'widget_class',
|
|
|
580 |
array(
|
581 |
'label' => __('Widget Class:', 'custom-menu-wizard'),
|
582 |
'desc' => __('Extra class for the widget itself', 'custom-menu-wizard')
|
583 |
+
) ); ?></div>
|
|
|
584 |
|
585 |
<?php $this->cmw_close_a_field_section(); ?>
|
586 |
|
590 |
*/
|
591 |
$this->cmw_open_a_field_section( $instance, __('Links', 'custom-menu-wizard'), 'fs_links' ); ?>
|
592 |
|
593 |
+
<div><?php $this->cmw_formfield_textbox( $instance, 'before',
|
|
|
594 |
array(
|
595 |
'label' => __('Before the Link:', 'custom-menu-wizard'),
|
596 |
'desc' =>__( htmlspecialchars('Text/HTML to go before the </a> of the link') , 'custom-menu-wizard'),
|
597 |
'fclass' => 'widefat'
|
598 |
+
) ); ?></div>
|
599 |
+
|
600 |
+
<div><?php $this->cmw_formfield_textbox( $instance, 'after',
|
|
|
601 |
array(
|
602 |
'label' => __('After the Link:', 'custom-menu-wizard'),
|
603 |
'desc' => __( htmlspecialchars('Text/HTML to go after the </a> of the link') , 'custom-menu-wizard'),
|
604 |
'fclass' => 'widefat'
|
605 |
+
) ); ?></div>
|
606 |
+
|
607 |
+
<div><?php $this->cmw_formfield_textbox( $instance, 'link_before',
|
|
|
608 |
array(
|
609 |
'label' => __('Before the Link Text:', 'custom-menu-wizard'),
|
610 |
'desc' => __('Text/HTML to go before the link text', 'custom-menu-wizard'),
|
611 |
'fclass' => 'widefat'
|
612 |
+
) ); ?></div>
|
613 |
+
|
614 |
+
<div><?php $this->cmw_formfield_textbox( $instance, 'link_after',
|
|
|
615 |
array(
|
616 |
'label' => __('After the Link Text:', 'custom-menu-wizard'),
|
617 |
'desc' => __('Text/HTML to go after the link text', 'custom-menu-wizard'),
|
618 |
'fclass' => 'widefat'
|
619 |
+
) ); ?></div>
|
|
|
620 |
|
621 |
<?php $this->cmw_close_a_field_section(); ?>
|
622 |
|
626 |
*/
|
627 |
$this->cmw_open_a_field_section( $instance, __('Alternative', 'custom-menu-wizard'), 'fs_alternative' ); ?>
|
628 |
|
629 |
+
<div><?php $this->cmw_assist_link(); ?>
|
|
|
630 |
|
631 |
<label for="<?php echo $this->get_field_id('switch_if'); ?>" class="cmw-followed-by"><?php _e('On condition:', 'custom-menu-wizard'); ?></label>
|
632 |
<br /><select id="<?php echo $this->get_field_id('switch_if'); ?>" class="cmw-switchable cmw-listen"
|
633 |
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('switch_if'); ?>">
|
634 |
+
<option value="" <?php selected( $instance['switch_if'], '' ); ?>> </option><?php
|
635 |
+
?><option value="current" <?php selected( $instance['switch_if'], 'current' ); ?>><?php _e('Current Item is in...', 'custom-menu-wizard'); ?></option><?php
|
636 |
+
?><option value="no-current" <?php selected( $instance['switch_if'], 'no-current' ); ?>><?php _e('Current Item is NOT in...', 'custom-menu-wizard'); ?></option><?php
|
637 |
+
?><option value="no-output" <?php selected( $instance['switch_if'], 'no-output' ); ?>><?php _e('No Output from...', 'custom-menu-wizard'); ?></option>
|
638 |
</select>
|
639 |
|
640 |
<select id="<?php echo $this->get_field_id('switch_at'); ?>" class="cmw-switchable cmw-listen"
|
641 |
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('switch_at'); ?>">
|
642 |
+
<option value="" <?php selected( $instance['switch_at'], '' ); ?>> </option><?php
|
643 |
+
?><option value="menu" <?php selected( $instance['switch_at'], 'menu' ); ?>><?php echo _e('Menu', 'custom-menu-wizard'); ?></option><?php
|
644 |
+
?><option value="primary" <?php selected( $instance['switch_at'], 'primary' ); ?>><?php echo _e('Primary Filter', 'custom-menu-wizard'); ?></option><?php
|
645 |
+
?><option value="secondary" <?php selected( $instance['switch_at'], 'secondary' ); ?>><?php echo _e('Secondary Filter', 'custom-menu-wizard'); ?></option><?php
|
646 |
+
?><option value="inclusions" <?php selected( $instance['switch_at'], 'inclusions' ); ?>><?php echo _e('Inclusions', 'custom-menu-wizard'); ?></option><?php
|
647 |
+
?><option value="output" <?php selected( $instance['switch_at'], 'output' ); ?>><?php echo _e('Final Output', 'custom-menu-wizard'); ?></option>
|
648 |
</select>
|
649 |
|
650 |
+
<br /><label class="cmw-disableifnot-sw<?php $this->cmw_disableif( 'push', $isNotSwitchable ); ?>"><?php _e('Then switch settings to:', 'custom-menu-wizard'); ?>
|
651 |
+
|
652 |
<br /><textarea rows="3" cols="20" <?php $this->cmw_disableif(); ?> id="<?php echo $this->get_field_id('switch_to'); ?>"
|
653 |
name="<?php echo $this->get_field_name('switch_to'); ?>"
|
654 |
class="widefat"><?php echo $instance['switch_to']; ?></textarea>
|
655 |
+
</label><?php $this->cmw_disableif( 'pop' ); ?><!-- end .cmw-disableifnot-sw -->
|
656 |
<span class="cmw-small-block cmw-indented"><em class="cmw-colour-grey">Enter/Paste a [cmwizard.../] shortcode</em></span>
|
657 |
|
658 |
</div>
|
665 |
<div class="cmw-shortcode-nojs cmw-small-block"><?php _e('With Javascript disabled, this is only guaranteed to be accurate when you <em>initially enter</em> Edit mode!', 'custom-menu-wizard'); ?></div>
|
666 |
<div class="cmw-shortcode-wrap"><code class="widget-<?php echo $this->id_base; ?>-shortcode ui-corner-all"
|
667 |
title="<?php esc_attr_e('stand-alone shortcode', 'custom-menu-wizard'); ?>"><?php echo self::cmw_shortcode( array_merge( $instance, array( 'menu' => $menus['selectedMenu'] ) ) ); ?></code></div>
|
668 |
+
<?php if( is_numeric( $this->number ) && $this->number > 0 ) : ?>
|
669 |
<div class="cmw-small-block"><em class="cmw-colour-grey"><?php _e('This <u>specific widget</u> can also be included using...', 'custom-menu-wizard'); ?></em></div>
|
670 |
<div class="cmw-shortcode-wrap"><code class="widget-<?php echo $this->id_base; ?>-shortcode cmw-instance-shortcode ui-corner-all"
|
671 |
title="<?php esc_attr_e('dependent shortcode', 'custom-menu-wizard'); ?>">[cmwizard widget=<?php echo $this->number; ?>/]</code></div>
|
672 |
+
<?php endif; ?>
|
673 |
</div>
|
674 |
|
675 |
</div>
|
676 |
+
|
677 |
<?php
|
678 |
|
679 |
if( $this->_cmw_accessibility ){
|
680 |
+
wp_localize_script(
|
681 |
+
Custom_Menu_Wizard_Plugin::$script_handle,
|
682 |
+
__CLASS__,
|
683 |
+
array( 'trigger' => '#' . $this->get_field_id('menu') )
|
684 |
+
);
|
685 |
}
|
686 |
|
687 |
} //end form()
|
746 |
//holds information determined by the walker...
|
747 |
$this->_cmw_walker = array();
|
748 |
|
|
|
|
|
|
|
749 |
//allow a filter to amend the instance settings prior to producing the widget output...
|
750 |
//eg. add_filter( 'custom_menu_wizard_settings_pre_widget', [filter_function], 10, 2 ) => $instance (array)
|
751 |
$instance = apply_filters( 'custom_menu_wizard_settings_pre_widget', $instance, $this->id_base );
|
809 |
|
810 |
//add my filters...
|
811 |
add_filter('custom_menu_wizard_walker_items', array( $this, 'cmw_filter_walker_items' ), 10, 2);
|
|
|
|
|
|
|
812 |
|
813 |
//allow a filter to amend the wp_nav_menu() params prior to calling it...
|
814 |
//eg. add_filter( 'custom_menu_wizard_nav_params', [filter_function], 10, 3 ) => $params (array)
|
817 |
|
818 |
//remove my filters...
|
819 |
remove_filter('custom_menu_wizard_walker_items', array( $this, 'cmw_filter_walker_items' ), 10, 2);
|
|
|
|
|
|
|
820 |
|
821 |
//only put something out if there is something to put out...
|
822 |
if( !empty( $out ) ){
|
908 |
//don't really need to worry about the id for non-javascript enabled usage because the css hides the
|
909 |
//button, but it doesn't hurt so I've left it in...
|
910 |
$hashid = $this->get_field_id( 'cmw' . ++$this->_cmw_hash_ct );
|
911 |
+
?><a class="widget-<?php echo $this->id_base; ?>-assist button" id="<?php echo $hashid; ?>" href="#<?php echo $hashid; ?>"><?php _e('assist', 'custom-menu-wizard'); ?></a><?php
|
|
|
|
|
912 |
|
913 |
}
|
914 |
|
960 |
|
961 |
}
|
962 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
963 |
/**
|
964 |
* v1.2.1 stores any walker-determined information back into the widget instance
|
965 |
* gets run by the walker, on the filtered array of menu items, just before running parent::walk()
|
991 |
$fieldClass = empty( $params['fclass'] ) ? '' : $params['fclass'];
|
992 |
$disabling = !empty( $labelClass ) && isset( $params['disableif'] );
|
993 |
?>
|
994 |
+
|
995 |
+
<label class="<?php echo $labelClass; if( $disabling ){ $this->cmw_disableif( 'push', $params['disableif'] ); } ?>">
|
996 |
+
<input type="checkbox" <?php $this->cmw_disableif(); ?> value="1" <?php
|
997 |
+
?>id="<?php echo $this->get_field_id( $field ); ?>" class="<?php echo $fieldClass; ?>" <?php
|
998 |
+
?>name="<?php echo $this->get_field_name( $field ); ?>" <?php checked($instance[ $field ]); ?> /><?php echo $params['label']; ?></label>
|
999 |
+
<?php if( $disabling ) :
|
1000 |
+
$this->cmw_disableif( 'pop' );
|
1001 |
+
endif;
|
1002 |
+
if( !empty( $params['desc'] ) ) : ?>
|
1003 |
+
<span class="cmw-small-block"><em class="cmw-colour-grey"><?php echo $params['desc']; ?></em></span>
|
1004 |
+
|
1005 |
+
<?php endif;
|
1006 |
|
1007 |
} // end cmw_formfield_checkbox()
|
1008 |
|
1017 |
|
1018 |
$fieldClass = empty( $params['fclass'] ) ? '' : $params['fclass'];
|
1019 |
|
1020 |
+
if( !empty( $params['label'] ) ) : ?>
|
1021 |
+
|
1022 |
+
<label for="<?php echo $this->get_field_id( $field ); ?>"><?php echo $params['label']; ?></label>
|
1023 |
+
<?php endif; ?>
|
1024 |
+
<input type="text" <?php $this->cmw_disableif(); ?> value="<?php echo $instance[ $field ]; ?>" <?php
|
1025 |
+
?>id="<?php echo $this->get_field_id( $field ); ?>" class="<?php echo $fieldClass; ?>" <?php
|
1026 |
+
?>name="<?php echo $this->get_field_name( $field ); ?>" />
|
1027 |
+
<?php if( !empty( $params['desc'] ) ) : ?>
|
1028 |
+
<span class="cmw-small-block"><em class="cmw-colour-grey"><?php echo $params['desc']; ?></em></span>
|
1029 |
+
|
1030 |
+
<?php endif;
|
|
|
|
|
|
|
|
|
1031 |
|
1032 |
} // end cmw_formfield_textbox()
|
1033 |
|
1128 |
$selected = selected( $selectedItem, $item->ID, false );
|
1129 |
if( !empty( $selected ) ){
|
1130 |
$rtn['selectedBranchName'] = $title;
|
1131 |
+
$selected .= ' ';
|
1132 |
}
|
1133 |
+
$rtn['selectedOptgroup'][ $sogCt ] .= '<option value="' . $item->ID . '" ' . $selected . 'data-cmw-level="' . $level . '" data-cmw-type="' . $item->type_label . '">';
|
1134 |
$rtn['selectedOptgroup'][ $sogCt ] .= str_repeat( ' ', ($level - 1) * 3 ) . esc_attr( $title ) . '</option>';
|
1135 |
}
|
1136 |
//don't set "selected" on the big list...
|
1137 |
+
$menuGrpOpts .= '<option value="' . $item->ID . '" data-cmw-level="' . $level . '" data-cmw-type="' . $item->type_label . '">';
|
1138 |
$menuGrpOpts .= str_repeat( ' ', ($level - 1) * 3 ) . esc_attr( $title ) . '</option>';
|
1139 |
}
|
1140 |
}
|
1191 |
|
1192 |
$hashid = $this->get_field_id( 'cmw' . ++$this->_cmw_hash_ct );
|
1193 |
?>
|
1194 |
+
|
1195 |
+
<a class="widget-<?php echo $this->id_base; ?>-fieldset dashicons-before<?php echo $instance[$fname] ? ' cmw-collapsed-fieldset' : ''; ?>"
|
1196 |
id="<?php echo $hashid; ?>" href="#<?php echo $hashid; ?>"><?php echo $text; ?></a>
|
1197 |
<input id="<?php echo $this->get_field_id($fname); ?>" class="cmw-display-none cmw-fieldset-state"
|
1198 |
+
name="<?php echo $this->get_field_name($fname); ?>" type="checkbox" value="1" <?php checked( $instance[$fname] ); ?> />
|
|
|
1199 |
<div class="cmw-fieldset<?php echo $instance[$fname] ? ' cmw-start-fieldset-collapsed' : ''; ?>">
|
1200 |
+
|
1201 |
<?php
|
1202 |
|
1203 |
} //end cmw_open_a_field_section()
|
1204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1205 |
/**
|
1206 |
* sanitizes the widget settings for update(), widget() and form()
|
1207 |
*
|
1250 |
'title_linked' => 0, //v3.1.4 added
|
1251 |
'ol_root' => 0,
|
1252 |
'ol_sub' => 0,
|
|
|
1253 |
//field section collapsed toggles...
|
1254 |
'fs_filters' => 1, //v3.0.0 replaces fs_filter and now starts out collapsed
|
1255 |
'fs_fallbacks' => 1,
|
1589 |
$instance = $this->cmw_legacy_settings( $instance, array(), 'form' );
|
1590 |
|
1591 |
//if no populated menus exist, suggest the user go create one...
|
1592 |
+
if( ( $menus = $this->cmw_scan_menus( $instance['menu'], $instance['filter_item'] ) ) === false ) : ?>
|
1593 |
+
|
1594 |
<p class="widget-<?php echo $this->id_base; ?>-no-menus">
|
1595 |
<?php printf( wp_kses( __('No populated menus have been created yet! <a href="%s">Create one...</a>', 'custom-menu-wizard'), array('a'=>array('href'=>array())) ), admin_url('nav-menus.php') ); ?>
|
1596 |
</p>
|
1597 |
+
|
1598 |
<?php
|
1599 |
return;
|
1600 |
+
endif;
|
1601 |
|
1602 |
//set up some simple booleans for use at the disableif___ classes...
|
1603 |
$isShowSpecific = $instance['filter'] < 0; // disableif-ss (IS show specific items)
|
1606 |
$isNotCurrentItem = $isNotChildrenOf || $instance['filter_item'] != 0; // disableifnot-ci (is NOT Children-of Current Item)
|
1607 |
|
1608 |
?>
|
1609 |
+
|
1610 |
<div id="<?php echo $this->get_field_id('onchange'); ?>"
|
1611 |
+
class="widget-<?php echo $this->id_base; ?>-onchange"
|
1612 |
+
data-cmw-instance-version='2.1.0'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1613 |
data-cmw-dialog-nonce='<?php echo wp_create_nonce( 'cmw-find-shortcodes' ); ?>'
|
1614 |
+
data-cmw-dialog-id='<?php echo $this->get_field_id('dialog'); ?>'
|
1615 |
+
data-cmw-legacy='true'>
|
1616 |
<?php
|
1617 |
/**
|
1618 |
* Legacy warning...
|
1624 |
<?php
|
1625 |
//allow a filter to return true, whereby updates to legacy widgets are disallowed...
|
1626 |
//eg. apply_filter( 'custom_menu_wizard_prevent_legacy_updates', [filter function], 10, 1 ) => true
|
1627 |
+
if( apply_filters( 'custom_menu_wizard_prevent_legacy_updates', false ) ) :
|
1628 |
?>
|
1629 |
<br /><?php _e('Any changes you make will NOT be Saved!', 'custom-menu-wizard'); ?>
|
1630 |
<?php
|
1631 |
+
endif;
|
1632 |
?>
|
1633 |
<br /><?php _e('Please consider creating a new instance of the widget to replace this one.', 'custom-menu-wizard'); ?>
|
1634 |
<a href="<?php echo $this->_cmw_legacy_warnreadmore; ?>" target="_blank"><?php _e('read more', 'custom-menu-wizard'); ?></a></em>
|
1635 |
</p>
|
1636 |
+
|
1637 |
<?php
|
1638 |
|
1639 |
/**
|
1669 |
*/
|
1670 |
$this->cmw_open_a_field_section( $instance, __('Filter', 'custom-menu-wizard'), 'fs_filter' );
|
1671 |
?>
|
1672 |
+
<p><?php $this->cmw_assist_link(); ?>
|
|
|
1673 |
<label>
|
1674 |
<input id="<?php echo $this->get_field_id('filter'); ?>_0" class="cmw-showall cmw-listen" <?php $this->cmw_disableif(); ?>
|
1675 |
name="<?php echo $this->get_field_name('filter'); ?>" type="radio" value="0" <?php checked( $instance['filter'], 0 ); ?> />
|
1704 |
<label for="<?php echo $this->get_field_id('start_level'); ?>"><?php _e('Starting Level:', 'custom-menu-wizard'); ?></label>
|
1705 |
<select id="<?php echo $this->get_field_id('start_level'); ?>" <?php $this->cmw_disableif(); ?>
|
1706 |
class="cmw-start-level" name="<?php echo $this->get_field_name('start_level'); ?>">
|
1707 |
+
<?php for( $i = 1; $i <= $menus['selectedLevels']; $i++ ) : ?>
|
1708 |
<option value="<?php echo $i; ?>" <?php selected( $instance['start_level'] > $menus['selectedLevels'] ? 1 : $instance['start_level'], $i ); ?>><?php echo $i; ?></option>
|
1709 |
+
<?php endfor; ?>
|
1710 |
</select>
|
1711 |
<span class="cmw-small-block"><em><?php _e('Level to start testing items for inclusion', 'custom-menu-wizard'); ?></em></span>
|
1712 |
+
</p><?php $this->cmw_disableif( 'pop' ); ?><!-- end .cmw-disableif-ss -->
|
1713 |
|
1714 |
<p class="cmw-disableif-ss<?php $this->cmw_disableif( 'push', $isShowSpecific ); ?>">
|
1715 |
<label for="<?php echo $this->get_field_id('depth'); ?>"><?php _e('For Depth:', 'custom-menu-wizard'); ?></label>
|
1716 |
+
<select id="<?php echo $this->get_field_id('depth'); ?>" class="cmw-depth"
|
1717 |
+
<?php $this->cmw_disableif(); ?> name="<?php echo $this->get_field_name('depth'); ?>">
|
1718 |
<option value="0" <?php selected( $instance['depth'] > $menus['selectedLevels'] ? 0 : $instance['depth'], 0 ); ?>><?php _e('unlimited', 'custom-menu-wizard'); ?></option>
|
1719 |
+
<?php for( $i = 1; $i <= $menus['selectedLevels']; $i++ ) : ?>
|
|
|
|
|
1720 |
<option value="<?php echo $i; ?>" <?php selected( $instance['depth'], $i ); ?>><?php printf( _n('%d level', '%d levels', $i, 'custom-menu-wizard'), $i ); ?></option>
|
1721 |
+
<?php endfor; ?>
|
|
|
|
|
1722 |
</select>
|
1723 |
<span class="cmw-small-block"><em><?php _e('Relative to first Filter item found, <strong>unless</strong>…', 'custom-menu-wizard'); ?></em></span>
|
1724 |
<?php $this->cmw_formfield_checkbox( $instance, 'depth_rel_current',
|
1725 |
array(
|
1726 |
'label' => __('Relative to Current Item <small><em>(if found)</em></small>', 'custom-menu-wizard')
|
1727 |
) ); ?>
|
1728 |
+
</p><?php $this->cmw_disableif( 'pop' ); ?><!-- end .cmw-disableif-ss -->
|
1729 |
|
1730 |
<?php $this->cmw_close_a_field_section(); ?>
|
1731 |
|
1735 |
*/
|
1736 |
$this->cmw_open_a_field_section( $instance, __('Fallbacks', 'custom-menu-wizard'), 'fs_fallbacks' );
|
1737 |
?>
|
1738 |
+
<p class="cmw-disableifnot-rp<?php $this->cmw_disableif( 'push', $isNotCurrentRootParent ); ?>"><?php $this->cmw_assist_link(); ?>
|
|
|
1739 |
<span class="cmw-small-block"><strong><?php _e( 'If "Children of" is <em>Current Root / Parent Item</em>, and no ancestor exists' , 'custom-menu-wizard'); ?> :</strong></span>
|
1740 |
<?php $this->cmw_formfield_checkbox( $instance, 'fallback_no_ancestor',
|
1741 |
array(
|
1742 |
'label' => __('Switch to Current Item, and', 'custom-menu-wizard')
|
1743 |
) ); ?>
|
1744 |
+
<br /><?php $this->cmw_formfield_checkbox( $instance, 'fallback_include_parent',
|
|
|
1745 |
array(
|
1746 |
'label' => __('Include Parent...', 'custom-menu-wizard')
|
1747 |
) ); ?>
|
1750 |
'label' => __('with Siblings', 'custom-menu-wizard'),
|
1751 |
'lclass' => 'cmw-whitespace-nowrap'
|
1752 |
) ); ?>
|
1753 |
+
</p><?php $this->cmw_disableif( 'pop' ); ?><!-- end .cmw-disableifnot-rp -->
|
1754 |
|
1755 |
<p class="cmw-disableifnot-ci<?php $this->cmw_disableif( 'push', $isNotCurrentItem ); ?>">
|
1756 |
<span class="cmw-small-block"><strong><?php _e( 'If "Children of" is <em>Current Item</em>, and current item has no children' , 'custom-menu-wizard'); ?> :</strong></span>
|
1768 |
'label' => __('with Siblings', 'custom-menu-wizard'),
|
1769 |
'lclass' => 'cmw-whitespace-nowrap'
|
1770 |
) ); ?>
|
1771 |
+
</p><?php $this->cmw_disableif( 'pop' ); ?><!-- end .cmw-disableifnot-ci -->
|
1772 |
|
1773 |
<?php $this->cmw_close_a_field_section(); ?>
|
1774 |
|
1778 |
*/
|
1779 |
$this->cmw_open_a_field_section( $instance, __('Output', 'custom-menu-wizard'), 'fs_output' );
|
1780 |
?>
|
1781 |
+
<p><?php $this->cmw_assist_link(); ?>
|
|
|
1782 |
<label>
|
1783 |
<input id="<?php echo $this->get_field_id('flat_output'); ?>_0" name="<?php echo $this->get_field_name('flat_output'); ?>"
|
1784 |
type="radio" value="0" <?php checked(!$instance['flat_output']); ?> <?php $this->cmw_disableif(); ?> />
|
1807 |
'label' => __('with Siblings', 'custom-menu-wizard'),
|
1808 |
'lclass' => 'cmw-whitespace-nowrap'
|
1809 |
) ); ?>
|
1810 |
+
<br /><?php $this->cmw_formfield_checkbox( $instance, 'include_ancestors',
|
|
|
1811 |
array(
|
1812 |
'label' => __('Include Ancestors', 'custom-menu-wizard')
|
1813 |
) ); ?>
|
1814 |
+
<br /><?php $this->cmw_formfield_checkbox( $instance, 'title_from_parent',
|
|
|
1815 |
array(
|
1816 |
'label' => __('Title from Parent', 'custom-menu-wizard'),
|
1817 |
'desc' => __('Only if the "Children of" Filter returns items', 'custom-menu-wizard')
|
1818 |
) ); ?>
|
1819 |
+
</p><?php $this->cmw_disableif( 'pop' ); ?><!-- end .cmw-disableif -->
|
1820 |
|
1821 |
<p>
|
1822 |
<?php $this->cmw_formfield_checkbox( $instance, 'title_from_current',
|
1828 |
|
1829 |
<p>
|
1830 |
<?php _e('Change UL to OL:', 'custom-menu-wizard'); ?>
|
1831 |
+
<br /><?php $this->cmw_formfield_checkbox( $instance, 'ol_root',
|
|
|
1832 |
array(
|
1833 |
'label' => __('Top Level', 'custom-menu-wizard')
|
1834 |
) ); ?>
|
1839 |
) ); ?>
|
1840 |
</p>
|
1841 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1842 |
<?php $this->cmw_close_a_field_section(); ?>
|
1843 |
|
1844 |
<?php
|
1967 |
'include_parent' => 0,
|
1968 |
'include_parent_siblings' => 0, //v1.1.0 added
|
1969 |
'include_ancestors' => 0,
|
|
|
1970 |
'title_from_parent' => 0,
|
1971 |
'title_from_current' => 0, //v1.2.0 added
|
1972 |
'ol_root' => 0,
|
2111 |
//sanitize $instance...
|
2112 |
$instance = $this->cmw_legacy_settings( $instance, array(), 'widget' );
|
2113 |
|
|
|
|
|
|
|
2114 |
//allow a filter to amend the instance settings prior to producing the widget output...
|
2115 |
//eg. add_filter( 'custom_menu_wizard_settings_pre_widget', [filter_function], 10, 2 ) => $instance (array)
|
2116 |
$instance = apply_filters( 'custom_menu_wizard_settings_pre_widget', $instance, $this->id_base );
|
2171 |
}
|
2172 |
|
2173 |
add_filter('custom_menu_wizard_walker_items', array( $this, 'cmw_filter_walker_items' ), 10, 2);
|
|
|
|
|
|
|
2174 |
|
2175 |
//allow a filter to amend the wp_nav_menu() params prior to calling it...
|
2176 |
//eg. add_filter( 'custom_menu_wizard_nav_params', [filter_function], 10, 3 ) => $params (array)
|
2178 |
$out = wp_nav_menu( apply_filters( 'custom_menu_wizard_nav_params', $params, $instance, $this->id_base ) );
|
2179 |
|
2180 |
remove_filter('custom_menu_wizard_walker_items', array( $this, 'cmw_filter_walker_items' ), 10, 2);
|
|
|
|
|
|
|
2181 |
|
2182 |
//only put something out if there is something to put out...
|
2183 |
if( !empty( $out ) ){
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: wizzud
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KP2LVCBXNCEB4
|
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 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 3.
|
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.
|
@@ -44,7 +44,7 @@ The associated **Shortcode Attributes** are documented
|
|
44 |
under [Installation](https://wordpress.org/plugins/custom-menu-wizard/installation/).
|
45 |
|
46 |
> You may find that the documentation here is truncated, so I have reproduced the readme.txt
|
47 |
-
|
48 |
This file is also now included in the plugin download, and is linked to from the Custom Menu Wizard entry
|
49 |
on the admin Plugins page.
|
50 |
My apologies if this causes - or has caused - any confusion.
|
@@ -405,16 +405,6 @@ swap the ULs out for OLs (ordered lists).
|
|
405 |
|
406 |
Swap any nested (ie. not the outermost) ULs for an OLs.
|
407 |
|
408 |
-
***Pre WordPress 3.6***
|
409 |
-
|
410 |
-
Please note that as of WordPress v3.6, the `Hide Widget if Empty` option becomes superfluous and will **not**
|
411 |
-
be presented (the wp_nav_menu() function has been modified to automatically suppress all HTML output if there
|
412 |
-
are no items to be displayed).
|
413 |
-
|
414 |
-
* **Hide Widget if Empty** *(checkbox)*
|
415 |
-
|
416 |
-
If checked, the widget will not output *any* HTML unless it finds at least one menu item that matches the Filter settings.
|
417 |
-
|
418 |
== Container Section ==
|
419 |
|
420 |
* **Element** *(textbox, default "div")*
|
@@ -530,6 +520,8 @@ Using this attribute reduces the shortcode length, and may cut down on maintenan
|
|
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.
|
535 |
|
@@ -937,6 +929,41 @@ setting `Branch=Current Item` is fine, but don't set `Branch=A Dynamic Item`; an
|
|
937 |
specific dynamic items, use a parent item that exists in the menu instead. If you can do that then there
|
938 |
should be no problem.
|
939 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
940 |
= How can I find all my posts/pages that have a CMW shortcode so that I can upgrade them? =
|
941 |
There is a button on the widget's "assist" - `[...]` - that will provide a list of posts/pages whose content, or meta data (custom fields),
|
942 |
contains any CMW shortcode. Each entry is a link that opens the item in a new tab/window. The link's title gives a bit more information :
|
@@ -953,7 +980,7 @@ because Version 2 will **not** be supported beyond Version 3.
|
|
953 |
|
954 |
|
955 |
== Screenshots ==
|
956 |
-
1. Widget
|
957 |
2. Filters Section
|
958 |
3. Fallbacks Section
|
959 |
4. Output Section
|
@@ -965,6 +992,20 @@ because Version 2 will **not** be supported beyond Version 3.
|
|
965 |
|
966 |
== Changelog ==
|
967 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
968 |
= 3.2.6 =
|
969 |
* addition : add cmw-current-item class to the menu item that CMW is using as 'current item'
|
970 |
|
@@ -1134,6 +1175,19 @@ because Version 2 will **not** be supported beyond Version 3.
|
|
1134 |
|
1135 |
== Upgrade Notice ==
|
1136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1137 |
= 3.2.6 =
|
1138 |
Adds cmw-current-item class to the menu item that CMW is using as 'current item'.
|
1139 |
|
2 |
Contributors: wizzud
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KP2LVCBXNCEB4
|
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.9
|
6 |
+
Tested up to: 4.5
|
7 |
+
Stable tag: 3.3.0
|
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.
|
44 |
under [Installation](https://wordpress.org/plugins/custom-menu-wizard/installation/).
|
45 |
|
46 |
> You may find that the documentation here is truncated, so I have reproduced the readme.txt
|
47 |
+
as [cmw-doc.html](http://www.wizzud.com/cmw-doc.html).
|
48 |
This file is also now included in the plugin download, and is linked to from the Custom Menu Wizard entry
|
49 |
on the admin Plugins page.
|
50 |
My apologies if this causes - or has caused - any confusion.
|
405 |
|
406 |
Swap any nested (ie. not the outermost) ULs for an OLs.
|
407 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
408 |
== Container Section ==
|
409 |
|
410 |
* **Element** *(textbox, default "div")*
|
520 |
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
|
521 |
Inactive Widgets area). You can override the widget instance's settings by supplying any of the other standard shortcode attributes.
|
522 |
|
523 |
+
Note that you can't use this attribute as part of an Alternative setting (it is simply ignored).
|
524 |
+
|
525 |
= title =
|
526 |
*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.
|
527 |
|
929 |
specific dynamic items, use a parent item that exists in the menu instead. If you can do that then there
|
930 |
should be no problem.
|
931 |
|
932 |
+
= What classes does CMW automatically assign? =
|
933 |
+
Every menu item :
|
934 |
+
|
935 |
+
* `cmw-level-N` : every menu item gets this class, with `N` being the hierarchical level of the item within the menu
|
936 |
+
shown (starting at 1). Note that selecting the *flat* output option does **not** affect the hierarchical level of
|
937 |
+
any item.
|
938 |
+
|
939 |
+
Certain menu items :
|
940 |
+
|
941 |
+
* `cmw-current-item` : assigned to the menu item that CMW has decided to use as the "current menu item".
|
942 |
+
* `cmw-has-submenu` : assigned to any menu item that has child items in the output menu.
|
943 |
+
* `cmw-menu-item-had-children` : assigned to any menu item that had child items in the original base
|
944 |
+
menu, *regardless* of whether it still has child items in the final output menu.
|
945 |
+
* `cmw-an-included-ancestor` : assigned to any menu item whose presence is solely due to a request to include ancestors.
|
946 |
+
* `cmw-an-included-ancestor-sibling` : assigned to any menu item whose presence is solely due to a request to include
|
947 |
+
the siblings of ancestors.
|
948 |
+
* `cmw-an-included-sibling` : assigned to any menu item whose presence is solely due to a request to include branch
|
949 |
+
item siblings.
|
950 |
+
* `cmw-an-included-level` : assigned to any menu item whose presence is solely due to a request to include one or
|
951 |
+
more levels.
|
952 |
+
|
953 |
+
The menu itself (the outermost list element) :
|
954 |
+
|
955 |
+
* `cmw-fellback-to-parent` : assigned to the menu when the fallback for *Current Item has no children* is set
|
956 |
+
to `Start at : -1 (parent)`, and it has been invoked.
|
957 |
+
* `cmw-fellback-to-current` : assigned to the menu when the fallback for *Current Item has no children* is set
|
958 |
+
to `Start at : the Current Item`, and it has been invoked.
|
959 |
+
* `cmw-invoked-alternative` : assigned to the menu when the output has been produced as a result of
|
960 |
+
an *alternative* configuration being brought into play.
|
961 |
+
|
962 |
+
The menu wrapper :
|
963 |
+
|
964 |
+
* `shortcode_custom_menu_wizard` : if the menu is produced from a `[cmwizard]` shortcode then this class is assigned
|
965 |
+
to the element that wraps the output.
|
966 |
+
|
967 |
= How can I find all my posts/pages that have a CMW shortcode so that I can upgrade them? =
|
968 |
There is a button on the widget's "assist" - `[...]` - that will provide a list of posts/pages whose content, or meta data (custom fields),
|
969 |
contains any CMW shortcode. Each entry is a link that opens the item in a new tab/window. The link's title gives a bit more information :
|
980 |
|
981 |
|
982 |
== Screenshots ==
|
983 |
+
1. Widget
|
984 |
2. Filters Section
|
985 |
3. Fallbacks Section
|
986 |
4. Output Section
|
992 |
|
993 |
== Changelog ==
|
994 |
|
995 |
+
= 3.3.0 =
|
996 |
+
* change : **minimum WordPress version is now 3.9!** (because require .dashicons-before, as part of needing to dump jQuery UI theme)
|
997 |
+
* bugfix : __! Possible Breaker !__ fixed incorrect determination of current item when a "current menu item" has a duplicate of itself as an ancestor (hopefully rare). There is a (very slight) chance that this may affect your displayed menu : if it does, toggle the Fallback option for *If more than 1 possible Current Item*, and I apologise for not catching the problem earlier
|
998 |
+
* change : dumped jQuery UI's Smoothness theme for WordPress's own CSS, to work around styling issues with WP4.5
|
999 |
+
* change : removed the hide_empty option (only relevant pre WP3.6) entirely
|
1000 |
+
* change : remove support for Widget Customizer plugin (part of core from WP3.9)
|
1001 |
+
* change : localized all text used by assist, to reduce byte footprint of the widget
|
1002 |
+
* add : in customizer, if there are no menus, link to the customizer's menus panel
|
1003 |
+
* add : opt in to customizer selective refresh for widgets (WP4.5)
|
1004 |
+
* bugfix : correction to regexps that sanitize the alternative
|
1005 |
+
* bugfix : corrected some problems with the assist dialog's auto-sizing, particularly after dragging
|
1006 |
+
* tweak : squidged the widget form a bit, to reduce byte footprint of the widget
|
1007 |
+
* tweak : included screenshots in html version of documentation
|
1008 |
+
|
1009 |
= 3.2.6 =
|
1010 |
* addition : add cmw-current-item class to the menu item that CMW is using as 'current item'
|
1011 |
|
1175 |
|
1176 |
== Upgrade Notice ==
|
1177 |
|
1178 |
+
= 3.3.0 =
|
1179 |
+
__! Important !__ : Minimum WordPress version is now 3.9.
|
1180 |
+
__! Possible Breaker !__ : Fixed bug with incorrect determination of current item when a "current menu item" has
|
1181 |
+
a duplicate of itself as an ancestor. If this changes your menu, toggle the Fallback option
|
1182 |
+
for *If more than 1 possible Current Item*, and I apologise for not catching the problem earlier.
|
1183 |
+
The redundant (since WP3.6) hide_empty option has gone,
|
1184 |
+
as has support for Widget Customizer plugin (now part of WP3.9 core).
|
1185 |
+
For WP4.5 compatibility, the Assist now uses WordPress core styling instead of a jQuery UI theme,
|
1186 |
+
and the widget opts in to the Customizer's 'selective refresh'.
|
1187 |
+
Fixed bug with the assist's resizing and the regexps that sanitize the alternative,
|
1188 |
+
and, to reduce the widget's bytesize,
|
1189 |
+
text used by assist has been localized and the widget form's HTML has been squidged a bit.
|
1190 |
+
|
1191 |
= 3.2.6 =
|
1192 |
Adds cmw-current-item class to the menu item that CMW is using as 'current item'.
|
1193 |
|