Advanced Sidebar Menu - Version 8.0.2

Version Description

  • Introduce new advanced-sidebar-menu/menus/category/get-child-terms filter
  • Support filtering the first level of categories.
  • Use is_excluded vs is_first_level_category in category view.
Download this release

Release Info

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

Code changes from version 8.0.1 to 8.0.2

advanced-sidebar-menu.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: https://onpointplugins.com/advanced-sidebar-menu/
5
  * Description: Creates dynamic menus based on parent/child relationship of your pages or categories.
6
  * Author: OnPoint Plugins
7
- * Version: 8.0.1
8
  * Author URI: https://onpointplugins.com
9
  * Text Domain: advanced-sidebar-menu
10
  *
@@ -15,7 +15,7 @@ if ( defined( 'ADVANCED_SIDEBAR_BASIC_VERSION' ) ) {
15
  return;
16
  }
17
 
18
- define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '8.0.1' );
19
  define( 'ADVANCED_SIDEBAR_MENU_REQUIRED_PRO_VERSION', '8.0.0' );
20
  define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
21
  define( 'ADVANCED_SIDEBAR_MENU_URL', plugin_dir_url( __FILE__ ) );
4
  * Plugin URI: https://onpointplugins.com/advanced-sidebar-menu/
5
  * Description: Creates dynamic menus based on parent/child relationship of your pages or categories.
6
  * Author: OnPoint Plugins
7
+ * Version: 8.0.2
8
  * Author URI: https://onpointplugins.com
9
  * Text Domain: advanced-sidebar-menu
10
  *
15
  return;
16
  }
17
 
18
+ define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '8.0.2' );
19
  define( 'ADVANCED_SIDEBAR_MENU_REQUIRED_PRO_VERSION', '8.0.0' );
20
  define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
21
  define( 'ADVANCED_SIDEBAR_MENU_URL', plugin_dir_url( __FILE__ ) );
readme.txt CHANGED
@@ -4,9 +4,9 @@ Contributors: Mat Lipe, onpointplugins
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40onpointplugins%2ecom&lc=US&item_name=Advanced%20Sidebar%20Menu&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
5
  Tags: menus, sidebar menu, hierarchy, category menu, pages menu
6
  Requires at least: 4.8.0
7
- Tested up to: 5.4.2
8
  Requires PHP: 5.6.0
9
- Stable tag: 8.0.1
10
 
11
  == Description ==
12
 
@@ -155,6 +155,11 @@ Yes. Based on whatever page, post, or category you are on, the menu will change
155
 
156
 
157
  == Changelog ==
 
 
 
 
 
158
  = 8.0.0 =
159
  Major version update. See <a href="https://onpointplugins.com/advanced-sidebar-menu/advanced-sidebar-menu-version-8-migration-guide/">migration guide</a> if you are extending the plugin's functionality via action, filters, or calling plugin classes.
160
 
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40onpointplugins%2ecom&lc=US&item_name=Advanced%20Sidebar%20Menu&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
5
  Tags: menus, sidebar menu, hierarchy, category menu, pages menu
6
  Requires at least: 4.8.0
7
+ Tested up to: 5.5.1
8
  Requires PHP: 5.6.0
9
+ Stable tag: 8.0.2
10
 
11
  == Description ==
12
 
155
 
156
 
157
  == Changelog ==
158
+ = 8.0.2 =
159
+ * Introduce new `advanced-sidebar-menu/menus/category/get-child-terms` filter
160
+ * Support filtering the first level of categories.
161
+ * Use `is_excluded` vs `is_first_level_category` in category view.
162
+
163
  = 8.0.0 =
164
  Major version update. See <a href="https://onpointplugins.com/advanced-sidebar-menu/advanced-sidebar-menu-version-8-migration-guide/">migration guide</a> if you are extending the plugin's functionality via action, filters, or calling plugin classes.
165
 
src/Debug.php CHANGED
@@ -58,28 +58,19 @@ class Debug {
58
  * @return void
59
  */
60
  public function print_instance( $asm, $widget ) {
61
- static $printed = false;
62
  $data = [
63
  'version' => ADVANCED_SIDEBAR_BASIC_VERSION,
64
- $widget->id => $asm->instance,
65
  ];
66
  if ( defined( 'ADVANCED_SIDEBAR_MENU_PRO_VERSION' ) ) {
67
  $data['pro_version'] = ADVANCED_SIDEBAR_MENU_PRO_VERSION;
68
  }
69
-
70
- if ( ! $printed ) {
71
- ?>
72
- <script class="<?php echo esc_attr( self::DEBUG_PARAM ); ?>">
73
  var <?php echo esc_attr( self::DEBUG_PARAM ); ?> = <?php echo wp_json_encode( $data ); ?>;
74
- </script>
75
- <?php
76
- $printed = true;
77
- } else {
78
- ?>
79
- <script class="<?php echo esc_attr( self::DEBUG_PARAM ); ?>">
80
- <?php echo esc_attr( self::DEBUG_PARAM ); ?>[ '<?php echo esc_js( $widget->id ); ?>' ] = <?php echo wp_json_encode( $asm->instance ); ?>;
81
- </script>
82
- <?php
83
- }
84
  }
85
  }
58
  * @return void
59
  */
60
  public function print_instance( $asm, $widget ) {
 
61
  $data = [
62
  'version' => ADVANCED_SIDEBAR_BASIC_VERSION,
 
63
  ];
64
  if ( defined( 'ADVANCED_SIDEBAR_MENU_PRO_VERSION' ) ) {
65
  $data['pro_version'] = ADVANCED_SIDEBAR_MENU_PRO_VERSION;
66
  }
67
+ ?>
68
+ <script class="<?php echo esc_attr( self::DEBUG_PARAM ); ?>">
69
+ if ( 'undefined' === typeof( <?php echo esc_attr( self::DEBUG_PARAM ); ?> ) ){
 
70
  var <?php echo esc_attr( self::DEBUG_PARAM ); ?> = <?php echo wp_json_encode( $data ); ?>;
71
+ }
72
+ <?php echo esc_attr( self::DEBUG_PARAM ); ?>[ '<?php echo esc_js( $widget->id ); ?>' ] = <?php echo wp_json_encode( $asm->instance ); ?>;
73
+ </script>
74
+ <?php
 
 
 
 
 
 
75
  }
76
  }
src/List_Pages.php CHANGED
@@ -139,9 +139,6 @@ class List_Pages {
139
  * @return array
140
  */
141
  public function get_args( $level = null ) {
142
- if ( null === $level ) {
143
- return $this->args;
144
- }
145
  $args = $this->args;
146
  switch ( $level ) {
147
  case Page::LEVEL_PARENT:
139
  * @return array
140
  */
141
  public function get_args( $level = null ) {
 
 
 
142
  $args = $this->args;
143
  switch ( $level ) {
144
  case Page::LEVEL_PARENT:
src/Menus/Category.php CHANGED
@@ -101,7 +101,7 @@ class Category extends Menu_Abstract {
101
  * @return \WP_Term[]
102
  */
103
  public function get_child_terms() {
104
- return array_filter(
105
  get_terms(
106
  [
107
  'taxonomy' => $this->get_taxonomy(),
@@ -111,6 +111,7 @@ class Category extends Menu_Abstract {
111
  ]
112
  )
113
  );
 
114
  }
115
 
116
 
@@ -381,7 +382,7 @@ class Category extends Menu_Abstract {
381
  $return = true;
382
  }
383
 
384
- return apply_filters( 'advanced_sidebar_menu_first_level_category', $return, $term, $this );
385
  }
386
 
387
 
101
  * @return \WP_Term[]
102
  */
103
  public function get_child_terms() {
104
+ $terms = array_filter(
105
  get_terms(
106
  [
107
  'taxonomy' => $this->get_taxonomy(),
111
  ]
112
  )
113
  );
114
+ return apply_filters( 'advanced-sidebar-menu/menus/category/get-child-terms', $terms, $this );
115
  }
116
 
117
 
382
  $return = true;
383
  }
384
 
385
+ return apply_filters( 'advanced-sidebar-menu/menus/category/is-first-level-term', $return, $term, $this );
386
  }
387
 
388
 
views/category_list.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * The output of the "Advanced Sidebar Categories Menu" widget
4
  *
5
- * @since 8.0.0
6
  *
7
  * To edit copy this file to a folder in your theme called 'advanced-sidebar-menu' and edit at will.
8
  *
@@ -35,7 +35,7 @@ if ( ! empty( $child_terms ) ) {
35
  } else {
36
  foreach ( $child_terms as $_term ) {
37
  // Child terms.
38
- if ( $current_menu->is_first_level_term( $_term ) ) {
39
  $list_args = $current_menu->get_list_categories_args( Category::LEVEL_CHILD, $_term );
40
  $content .= $current_menu->openListItem( wp_list_categories( $list_args ) );
41
 
2
  /**
3
  * The output of the "Advanced Sidebar Categories Menu" widget
4
  *
5
+ * @since 8.0.2
6
  *
7
  * To edit copy this file to a folder in your theme called 'advanced-sidebar-menu' and edit at will.
8
  *
35
  } else {
36
  foreach ( $child_terms as $_term ) {
37
  // Child terms.
38
+ if ( ! $current_menu->is_excluded( $_term->term_id ) ) {
39
  $list_args = $current_menu->get_list_categories_args( Category::LEVEL_CHILD, $_term );
40
  $content .= $current_menu->openListItem( wp_list_categories( $list_args ) );
41