Advanced Sidebar Menu - Version 4.6.1

Version Description

Download this release

Release Info

Developer Mat Lipe
Plugin Icon 128x128 Advanced Sidebar Menu
Version 4.6.1
Comparing to
See all releases

Code changes from version 4.6.0 to 4.6.1

advanced-sidebar-menu.php CHANGED
@@ -4,12 +4,12 @@ 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: 4.6.0
8
  Author URI: http://matlipe.com
9
- Since: 11.9.13
10
  */
11
 
12
- define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '4.6' );
13
 
14
 
15
 
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: 4.6.1
8
  Author URI: http://matlipe.com
9
+ Since: 11.15.13
10
  */
11
 
12
+ define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '4.6.1' );
13
 
14
 
15
 
lib/advancedSidebarMenu.php CHANGED
@@ -18,11 +18,6 @@ class advancedSidebarMenu{
18
  var $taxonomy; //For filters to override the taxonomy
19
  var $current_term; //Current category or taxonomy
20
 
21
-
22
-
23
-
24
-
25
-
26
 
27
  /**
28
  * Check is a page has children by id
18
  var $taxonomy; //For filters to override the taxonomy
19
  var $current_term; //Current category or taxonomy
20
 
 
 
 
 
 
21
 
22
  /**
23
  * Check is a page has children by id
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.1
7
  Tested up to: 3.7.1
8
- Stable tag: 4.6.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.1
7
  Tested up to: 3.7.1
8
+ Stable tag: 4.6.1
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
@@ -5,7 +5,7 @@
5
  * Creates a Widget of parent Child Categories
6
  *
7
  * @author mat lipe
8
- * @since 11.4.13
9
  * @package Advanced Sidebar Menu
10
  *
11
  * @todo Clean this bad boy up. Still rookie code from years ago
@@ -169,7 +169,7 @@ class advanced_sidebar_menu_category extends WP_Widget {
169
  /**
170
  * Outputs the categories widget to the page
171
  *
172
- * @since 11.4.13
173
  * @uses loads the views/category_list.php
174
  *
175
  * @filters apply_filters('advanced_sidebar_menu_category_widget_output', $content, $args, $instance );
@@ -190,7 +190,8 @@ class advanced_sidebar_menu_category extends WP_Widget {
190
  'exclude' => '',
191
  'legacy_mode' => false,
192
  'display_all' => false,
193
- 'levels' => 1
 
194
  );
195
 
196
  $instance = wp_parse_args( $instance, $defaults);
@@ -201,6 +202,9 @@ class advanced_sidebar_menu_category extends WP_Widget {
201
  $asm = new advancedSidebarMenu;
202
  $asm->instance = $instance;
203
  $asm->args = $args;
 
 
 
204
 
205
  do_action( 'advanced_sidebar_menu_widget_pre_render', $asm, $this );
206
 
@@ -223,7 +227,7 @@ class advanced_sidebar_menu_category extends WP_Widget {
223
  global $post;
224
  $category_array = wp_get_object_terms($post->ID, $asm->taxonomy);
225
 
226
- //Sort by term_order to work with some plugins
227
  $asm->order_by = apply_filters('advanced_sidebar_menu_category_orderby', 'name', $args, $instance );
228
 
229
  uasort( $category_array, array( $asm, 'sortTerms'));
@@ -234,6 +238,7 @@ class advanced_sidebar_menu_category extends WP_Widget {
234
 
235
  //IF on a category page get the id of the category
236
  } elseif( is_tax() || is_category() ){
 
237
  $asm->current_term = get_queried_object()->term_id;
238
  $cat_ids[] = get_queried_object()->term_id;
239
  }
@@ -254,14 +259,17 @@ class advanced_sidebar_menu_category extends WP_Widget {
254
  if( in_array( $asm->top_id, $already_top ) ) continue;
255
 
256
  $already_top[] = $asm->top_id;
257
-
258
-
259
  //Check for children
260
- $all_categories = $all = array_filter( get_terms( $asm->taxonomy, array(
261
- 'child_of' => $asm->top_id,
262
- 'orderby' => $asm->order_by )
263
- )
264
- );
 
 
 
 
265
 
266
  //For Backwards Compatibility
267
  foreach( $all_categories as $tc ){
5
  * Creates a Widget of parent Child Categories
6
  *
7
  * @author mat lipe
8
+ * @since 11.15.13
9
  * @package Advanced Sidebar Menu
10
  *
11
  * @todo Clean this bad boy up. Still rookie code from years ago
169
  /**
170
  * Outputs the categories widget to the page
171
  *
172
+ * @since 11.15.13
173
  * @uses loads the views/category_list.php
174
  *
175
  * @filters apply_filters('advanced_sidebar_menu_category_widget_output', $content, $args, $instance );
190
  'exclude' => '',
191
  'legacy_mode' => false,
192
  'display_all' => false,
193
+ 'levels' => 1,
194
+ 'order' => 'DESC'
195
  );
196
 
197
  $instance = wp_parse_args( $instance, $defaults);
202
  $asm = new advancedSidebarMenu;
203
  $asm->instance = $instance;
204
  $asm->args = $args;
205
+
206
+ //Had to display twice for backward compat - because originaly not set to anything
207
+ $asm->order_by = apply_filters('advanced_sidebar_menu_category_orderby', null, $args, $instance );
208
 
209
  do_action( 'advanced_sidebar_menu_widget_pre_render', $asm, $this );
210
 
227
  global $post;
228
  $category_array = wp_get_object_terms($post->ID, $asm->taxonomy);
229
 
230
+ //Sort by a field like term order for other plugins
231
  $asm->order_by = apply_filters('advanced_sidebar_menu_category_orderby', 'name', $args, $instance );
232
 
233
  uasort( $category_array, array( $asm, 'sortTerms'));
238
 
239
  //IF on a category page get the id of the category
240
  } elseif( is_tax() || is_category() ){
241
+
242
  $asm->current_term = get_queried_object()->term_id;
243
  $cat_ids[] = get_queried_object()->term_id;
244
  }
259
  if( in_array( $asm->top_id, $already_top ) ) continue;
260
 
261
  $already_top[] = $asm->top_id;
262
+
 
263
  //Check for children
264
+ $all_categories = $all = array_filter(
265
+ get_terms(
266
+ $asm->taxonomy, array(
267
+ 'child_of' => $asm->top_id,
268
+ 'orderby' => $asm->order_by,
269
+ 'order' => $instance['order']
270
+ )
271
+ )
272
+ );
273
 
274
  //For Backwards Compatibility
275
  foreach( $all_categories as $tc ){