Version Description
Download this release
Release Info
Developer | Mat Lipe |
Plugin | Advanced Sidebar Menu |
Version | 5.0.7 |
Comparing to | |
See all releases |
Code changes from version 5.0.6 to 5.0.7
- advanced-sidebar-menu.php +2 -2
- readme.txt +1 -1
- widgets/category.widget.php +355 -337
advanced-sidebar-menu.php
CHANGED
@@ -4,11 +4,11 @@ Plugin Name: Advanced Sidebar Menu
|
|
4 |
Plugin URI: http://matlipe.com/advanced-sidebar-menu/
|
5 |
Description: Creates dynamic menu based on child/parent relationship.
|
6 |
Author: Mat Lipe
|
7 |
-
Version: 5.0.
|
8 |
Author URI: http://matlipe.com
|
9 |
*/
|
10 |
|
11 |
-
define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '5.0.
|
12 |
|
13 |
|
14 |
#-- Define Constants
|
4 |
Plugin URI: http://matlipe.com/advanced-sidebar-menu/
|
5 |
Description: Creates dynamic menu based on child/parent relationship.
|
6 |
Author: Mat Lipe
|
7 |
+
Version: 5.0.7
|
8 |
Author URI: http://matlipe.com
|
9 |
*/
|
10 |
|
11 |
+
define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '5.0.7' );
|
12 |
|
13 |
|
14 |
#-- Define Constants
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypa
|
|
5 |
Tags: menus, sidebar menu, heirchy, category menu, pages menu
|
6 |
Requires at least: 3.8.0
|
7 |
Tested up to: 4.2.2
|
8 |
-
Stable tag: 5.0.
|
9 |
|
10 |
Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
|
11 |
|
5 |
Tags: menus, sidebar menu, heirchy, category menu, pages menu
|
6 |
Requires at least: 3.8.0
|
7 |
Tested up to: 4.2.2
|
8 |
+
Stable tag: 5.0.7
|
9 |
|
10 |
Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
|
11 |
|
widgets/category.widget.php
CHANGED
@@ -1,341 +1,359 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
class advanced_sidebar_menu_category extends WP_Widget {
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
#-------------------------------------------------------------------------------------------------------------------------
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
</p>
|
106 |
</span>
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
} #== /Clas
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Creates a Widget of parent Child Categories
|
6 |
+
*
|
7 |
+
* @author mat lipe
|
8 |
+
* @since 1.7.14
|
9 |
+
* @package Advanced Sidebar Menu
|
10 |
+
*
|
11 |
+
* @todo Clean this bad boy up. Still rookie code from years ago
|
12 |
+
*
|
13 |
+
*
|
14 |
+
*/
|
15 |
class advanced_sidebar_menu_category extends WP_Widget {
|
16 |
+
|
17 |
+
private $defaults = array(
|
18 |
+
'title' => false,
|
19 |
+
'include_parent' => false,
|
20 |
+
'include_childless_parent' => false,
|
21 |
+
'single' => false,
|
22 |
+
'css' => false,
|
23 |
+
'exclude' => false,
|
24 |
+
'new_widget' => 'list',
|
25 |
+
'legacy_mode' => false,
|
26 |
+
'display_all' => false,
|
27 |
+
'levels' => 1
|
28 |
+
);
|
29 |
+
|
30 |
+
|
31 |
+
#-------------------------------------------------------------------------------------------------------------------------
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Build the widget like a Baller
|
35 |
+
*
|
36 |
+
* @since 8.1.13
|
37 |
+
*/
|
38 |
+
function __construct(){
|
39 |
+
/* Widget settings. */
|
40 |
+
$widget_ops = array(
|
41 |
+
'classname' => 'advanced-sidebar-menu advanced-sidebar-category',
|
42 |
+
'description' => 'Creates a menu of all the Categories using the child/parent relationship'
|
43 |
+
);
|
44 |
+
$control_ops = array( 'width' => 290 );
|
45 |
+
/* Create the widget. */
|
46 |
+
$this->WP_Widget( 'advanced_sidebar_menu_category', 'Advanced Sidebar Categories Menu', $widget_ops, $control_ops );
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Creates a form for the Widget Options
|
52 |
+
*
|
53 |
+
* @since 1.7.14
|
54 |
+
*
|
55 |
+
* @param array $instance
|
56 |
+
*
|
57 |
+
* @actions do_action('advanced_sidebar_menu_category_widget_form', $instance );
|
58 |
+
*/
|
59 |
+
function form( $instance ){
|
60 |
+
|
61 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
62 |
+
|
63 |
+
?>
|
64 |
+
<p> <?php _e( 'Title', 'advanced-sidebar-menu' ); ?>
|
65 |
+
<br>
|
66 |
+
<input id="<?php echo $this->get_field_name( 'title' ); ?>"
|
67 |
+
name="<?php echo $this->get_field_name( 'title' ); ?>" class="widefat" type="text" value="<?php echo $instance[ 'title' ]; ?>"/>
|
68 |
+
</p>
|
69 |
+
|
70 |
+
|
71 |
+
<p> <?php _e( 'Include Parent Category', 'advanced-sidebar-menu' ); ?>
|
72 |
+
<input id="<?php echo $this->get_field_name( 'include_parent' ); ?>"
|
73 |
+
name="<?php echo $this->get_field_name( 'include_parent' ); ?>" type="checkbox" value="checked"
|
74 |
+
<?php echo $instance[ 'include_parent' ]; ?>/>
|
75 |
+
</p>
|
76 |
+
|
77 |
+
|
78 |
+
<p> <?php _e( 'Include Parent Even With No Children', 'advanced-sidebar-menu' ); ?>
|
79 |
+
<input id="<?php echo $this->get_field_name( 'include_childless_parent' ); ?>"
|
80 |
+
name="<?php echo $this->get_field_name( 'include_childless_parent' ); ?>" type="checkbox" value="checked"
|
81 |
+
<?php echo $instance[ 'include_childless_parent' ]; ?>/>
|
82 |
+
</p>
|
83 |
+
|
84 |
+
<p> <?php _e( 'Use this plugins styling', 'advanced-sidebar-menu' ); ?>
|
85 |
+
<input id="<?php echo $this->get_field_name( 'css' ); ?>"
|
86 |
+
name="<?php echo $this->get_field_name( 'css' ); ?>" type="checkbox" value="checked"
|
87 |
+
<?php echo $instance[ 'css' ]; ?>/>
|
88 |
+
</p>
|
89 |
+
|
90 |
+
<p> <?php _e( 'Display Categories on Single Posts', 'advanced-sidebar-menu' ); ?>
|
91 |
+
<input id="<?php echo $this->get_field_name( 'single' ); ?>"
|
92 |
+
name="<?php echo $this->get_field_name( 'single' ); ?>" type="checkbox" value="checked"
|
93 |
+
onclick="javascript:asm_reveal_element( 'new-widget-<?php echo $this->get_field_name( 'new_widget' ); ?>' )"
|
94 |
+
<?php echo $instance[ 'single' ]; ?>/>
|
95 |
+
</p>
|
96 |
+
|
97 |
+
<span id="new-widget-<?php echo $this->get_field_name( 'new_widget' ); ?>" style="<?php
|
98 |
+
if( $instance[ 'single' ] == 'checked' ){
|
99 |
+
echo 'display:block';
|
100 |
+
} else {
|
101 |
+
echo 'display:none';
|
102 |
+
} ?>">
|
103 |
+
<p><?php _e( "Display Each Single Post's Category", 'advanced-sidebar-menu' ); ?>
|
104 |
+
<select id="<?php echo $this->get_field_name( 'new_widget' ); ?>"
|
105 |
+
name="<?php echo $this->get_field_name( 'new_widget' ); ?>">
|
106 |
+
<?php
|
107 |
+
if( $instance[ 'new_widget' ] == 'widget' ){
|
108 |
+
echo '<option value="widget" selected> In a new widget </option>';
|
109 |
+
echo '<option value="list"> In another list in the same widget </option>';
|
110 |
+
} else {
|
111 |
+
echo '<option value="widget"> In a new widget </option>';
|
112 |
+
echo '<option value="list" selected> In another list in the same widget </option>';
|
113 |
+
}
|
114 |
+
|
115 |
+
?></select>
|
116 |
</p>
|
117 |
</span>
|
118 |
+
|
119 |
+
|
120 |
+
|
121 |
+
<p> <?php _e( "Categories to Exclude, Comma Separated", 'advanced-sidebar-menu' ); ?>:
|
122 |
+
<input id="<?php echo $this->get_field_name( 'exclude' ); ?>"
|
123 |
+
name="<?php echo $this->get_field_name( 'exclude' ); ?>" type="text" class="widefat" value="<?php echo $instance[ 'exclude' ]; ?>"/>
|
124 |
+
</p>
|
125 |
+
|
126 |
+
|
127 |
+
<p> <?php _e( "Legacy Mode: (use pre 4.0 structure and css)", 'advanced-sidebar-menu' ); ?>
|
128 |
+
<input id="<?php echo $this->get_field_name( 'legacy_mode' ); ?>"
|
129 |
+
name="<?php echo $this->get_field_name( 'legacy_mode' ); ?>" type="checkbox" value="checked"
|
130 |
+
<?php echo $instance[ 'legacy_mode' ]; ?>/>
|
131 |
+
</p>
|
132 |
+
|
133 |
+
|
134 |
+
<p> <?php _e( "Always Display Child Categories", 'advanced-sidebar-menu' ); ?>
|
135 |
+
<input id="<?php echo $this->get_field_name( 'display_all' ); ?>"
|
136 |
+
name="<?php echo $this->get_field_name( 'display_all' ); ?>" type="checkbox" value="checked"
|
137 |
+
onclick="javascript:asm_reveal_element( 'levels-<?php echo $this->get_field_name( 'levels' ); ?>' )"
|
138 |
+
<?php echo $instance[ 'display_all' ]; ?>/>
|
139 |
+
</p>
|
140 |
+
|
141 |
+
<span id="levels-<?php echo $this->get_field_name( 'levels' ); ?>" style="<?php
|
142 |
+
if( $instance[ 'display_all' ] == 'checked' ){
|
143 |
+
echo 'display:block';
|
144 |
+
} else {
|
145 |
+
echo 'display:none';
|
146 |
+
} ?>">
|
147 |
+
<p> <?php _e( "Levels to Display", 'advanced-sidebar-menu' ); ?>
|
148 |
+
<select id="<?php echo $this->get_field_name( 'levels' ); ?>"
|
149 |
+
name="<?php echo $this->get_field_name( 'levels' ); ?>">
|
150 |
+
<?php
|
151 |
+
for( $i = 1; $i < 6; $i ++ ){
|
152 |
+
if( $i == $instance[ 'levels' ] ){
|
153 |
+
echo '<option value="' . $i . '" selected>' . $i . '</option>';
|
154 |
+
} else {
|
155 |
+
echo '<option value="' . $i . '">' . $i . '</option>';
|
156 |
+
}
|
157 |
+
}
|
158 |
+
echo '</select></p></span>';
|
159 |
+
|
160 |
+
do_action( 'advanced_sidebar_menu_category_widget_form', $instance, $this );
|
161 |
+
|
162 |
+
do_action( 'advanced_sidebar_menu_after_widget_form', $instance, $this );
|
163 |
+
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Updates the widget data
|
169 |
+
*
|
170 |
+
* @filter - $newInstance = apply_filters('advanced_sidebar_menu_category_widget_update', $newInstance, $oldInstance );
|
171 |
+
* @since 5.19.13
|
172 |
+
*/
|
173 |
+
function update( $newInstance, $oldInstance ){
|
174 |
+
$newInstance[ 'exclude' ] = strip_tags( $newInstance[ 'exclude' ] );
|
175 |
+
$newInstance = apply_filters( 'advanced_sidebar_menu_category_widget_update', $newInstance, $oldInstance );
|
176 |
+
|
177 |
+
return $newInstance;
|
178 |
+
}
|
179 |
+
|
180 |
+
|
181 |
+
|
182 |
+
|
183 |
+
#---------------------------------------------------------------------------------------------------------------------------
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Outputs the categories widget to the page
|
187 |
+
*
|
188 |
+
* @since 11.15.13
|
189 |
+
* @uses loads the views/category_list.php
|
190 |
+
*
|
191 |
+
* @filters apply_filters('advanced_sidebar_menu_category_widget_output', $content, $args, $instance );
|
192 |
+
* apply_filters('advanced_sidebar_menu_taxonomy', 'post', $args, $instance );
|
193 |
+
* apply_filters('advanced_sidebar_menu_proper_single', $asm->checked('single'), $args, $instance)
|
194 |
+
* apply_filters( 'advanced_sidebar_menu_category_ids', $cat_ids, $args, $instance )
|
195 |
+
*
|
196 |
+
*/
|
197 |
+
function widget( $args, $instance ){
|
198 |
+
|
199 |
+
$defaults = array(
|
200 |
+
'title' => '',
|
201 |
+
'include_parent' => false,
|
202 |
+
'include_childless_parent' => false,
|
203 |
+
'css' => false,
|
204 |
+
'single' => false,
|
205 |
+
'new_widget' => 'widget',
|
206 |
+
'exclude' => '',
|
207 |
+
'legacy_mode' => false,
|
208 |
+
'display_all' => false,
|
209 |
+
'levels' => 1,
|
210 |
+
'order' => 'DESC'
|
211 |
+
);
|
212 |
+
|
213 |
+
$instance = wp_parse_args( $instance, $defaults );
|
214 |
+
|
215 |
+
if( is_single() && !isset( $instance[ 'single' ] ) ){
|
216 |
+
return;
|
217 |
+
}
|
218 |
+
$asm = new advancedSidebarMenu;
|
219 |
+
$asm->instance = $instance;
|
220 |
+
$asm->args = $args;
|
221 |
+
|
222 |
+
//Had to display twice for backward compat - because originaly not set to anything
|
223 |
+
$asm->order_by = apply_filters( 'advanced_sidebar_menu_category_orderby', null, $args, $instance );
|
224 |
+
|
225 |
+
do_action( 'advanced_sidebar_menu_widget_pre_render', $asm, $this );
|
226 |
+
|
227 |
+
$legacy = $asm->checked( 'legacy_mode' );
|
228 |
+
|
229 |
+
$cat_ids = $already_top = array();
|
230 |
+
$asm_once = false; //keeps track of how many widgets this created
|
231 |
+
|
232 |
+
$exclude = explode( ',', $instance[ 'exclude' ] );
|
233 |
+
$asm->exclude = $exclude;
|
234 |
+
|
235 |
+
$asm->taxonomy = apply_filters( 'advanced_sidebar_menu_taxonomy', 'category', $args, $instance );
|
236 |
+
|
237 |
+
extract( $args );
|
238 |
+
|
239 |
+
//If on a single page create an array of each category and create a list for each
|
240 |
+
if( is_single() ){
|
241 |
+
if( !apply_filters( 'advanced_sidebar_menu_proper_single', $asm->checked( 'single' ), $args, $instance ) ){
|
242 |
+
return;
|
243 |
+
}
|
244 |
+
global $post;
|
245 |
+
$category_array = wp_get_object_terms( $post->ID, $asm->taxonomy );
|
246 |
+
|
247 |
+
//Sort by a field like term order for other plugins
|
248 |
+
$asm->order_by = apply_filters( 'advanced_sidebar_menu_category_orderby', 'name', $args, $instance );
|
249 |
+
|
250 |
+
uasort( $category_array, array( $asm, 'sortTerms' ) );
|
251 |
+
|
252 |
+
foreach( $category_array as $id => $cat ){
|
253 |
+
$cat_ids[ ] = $cat->term_id;
|
254 |
+
}
|
255 |
+
|
256 |
+
//IF on a category page get the id of the category
|
257 |
+
} elseif( is_tax() || is_category() ) {
|
258 |
+
|
259 |
+
$asm->current_term = get_queried_object()->term_id;
|
260 |
+
$cat_ids[ ] = get_queried_object()->term_id;
|
261 |
+
}
|
262 |
+
|
263 |
+
$cat_ids = apply_filters( 'advanced_sidebar_menu_category_ids', $cat_ids, $args, $instance );
|
264 |
+
|
265 |
+
if( empty( $cat_ids ) ){
|
266 |
+
return;
|
267 |
+
}
|
268 |
+
|
269 |
+
//Go through each category there will be only one if this is a category page mulitple possible if this is single
|
270 |
+
foreach( $cat_ids as $cat_id ){
|
271 |
+
|
272 |
+
//Get the top category id
|
273 |
+
$asm->top_id = $asm->getTopCat( $cat_id );
|
274 |
+
|
275 |
+
//Keeps track or already used top levels so this won't double up
|
276 |
+
if( in_array( $asm->top_id, $already_top ) ){
|
277 |
+
continue;
|
278 |
+
}
|
279 |
+
|
280 |
+
$already_top[ ] = $asm->top_id;
|
281 |
+
|
282 |
+
//Check for children
|
283 |
+
$all_categories = $all = array_filter(
|
284 |
+
get_terms(
|
285 |
+
$asm->taxonomy, array(
|
286 |
+
'child_of' => $asm->top_id,
|
287 |
+
'orderby' => $asm->order_by,
|
288 |
+
'order' => $instance[ 'order' ]
|
289 |
+
)
|
290 |
+
)
|
291 |
+
);
|
292 |
+
|
293 |
+
//For Backwards Compatibility
|
294 |
+
foreach( $all_categories as $tc ){
|
295 |
+
$tc->cat_ID = $tc->term_id;
|
296 |
+
}
|
297 |
+
|
298 |
+
//If there are no children and not displaying childless parent - bail
|
299 |
+
if( empty( $all_categories ) && !( $asm->checked( 'include_childless_parent' ) ) ){
|
300 |
+
continue;
|
301 |
+
}
|
302 |
+
//If there are no children and the parent is excluded bail
|
303 |
+
if( empty( $all_categories ) && in_array( $asm->top_id, $exclude ) ){
|
304 |
+
continue;
|
305 |
+
}
|
306 |
+
|
307 |
+
//Creates a new widget for each category the single page has if the options are selected to do so
|
308 |
+
//Also starts the first widget
|
309 |
+
if( !$asm_once || ( $instance[ 'new_widget' ] == 'widget' ) ){
|
310 |
+
|
311 |
+
//Start the menu
|
312 |
+
echo $before_widget;
|
313 |
+
if( !$asm_once ){
|
314 |
+
$asm->title();
|
315 |
+
if( $asm->checked( 'css' ) ){
|
316 |
+
echo '<style type="text/css">';
|
317 |
+
include( $asm->file_hyercy( 'sidebar-menu.css', $legacy ) );
|
318 |
+
echo '</style>';
|
319 |
+
}
|
320 |
+
|
321 |
+
$asm_once = true; //There has been a div
|
322 |
+
$close = true; //The div should be closed at the end
|
323 |
+
|
324 |
+
if( $instance[ 'new_widget' ] == 'list' ){
|
325 |
+
$close = false; //If this is a list leave it open for now
|
326 |
+
}
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
+
//for deprecation
|
331 |
+
$top_cat = $asm->top_id;
|
332 |
+
$cat_ancestors = $asm->ancestors;
|
333 |
+
|
334 |
+
//Bring in the view
|
335 |
+
require( $asm->file_hyercy( 'category_list.php', $legacy ) );
|
336 |
+
|
337 |
+
echo apply_filters( 'advanced_sidebar_menu_category_widget_output', $content, $args, $instance );
|
338 |
+
|
339 |
+
if( $close ){
|
340 |
+
//End the Widget Area
|
341 |
+
echo $after_widget;
|
342 |
+
echo '<!-- First $after_widget -->';
|
343 |
+
}
|
344 |
+
|
345 |
+
|
346 |
+
} //End of each cat loop
|
347 |
+
|
348 |
+
//IF we were waiting for all the individual lists to complete
|
349 |
+
if( !$close && $asm_once ){
|
350 |
+
//End the Widget Area
|
351 |
+
echo $after_widget;
|
352 |
+
echo '<!-- Second $after_widget -->';
|
353 |
+
|
354 |
+
}
|
355 |
+
|
356 |
+
|
357 |
+
} #== /widget()
|
358 |
+
|
359 |
} #== /Clas
|