Advanced Sidebar Menu - Version 8.4.0

Version Description

  • Introduce new Category Walker to increase extensibility.
  • Support data-level on all widgets.
  • Complete preparations for PRO version 8.4.
  • Minimum required version for PRO 8.4.
Download this release

Release Info

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

Code changes from version 8.3.4 to 8.4.0

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.3.4
8
  * Author URI: https://onpointplugins.com
9
  * Text Domain: advanced-sidebar-menu
10
  * Domain Path: /languages/
@@ -19,7 +19,7 @@ if ( defined( 'ADVANCED_SIDEBAR_BASIC_VERSION' ) ) {
19
  return;
20
  }
21
 
22
- define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '8.3.4' );
23
  define( 'ADVANCED_SIDEBAR_MENU_REQUIRED_PRO_VERSION', '8.2.0' );
24
  define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
25
  define( 'ADVANCED_SIDEBAR_MENU_URL', plugin_dir_url( __FILE__ ) );
@@ -35,6 +35,7 @@ use Advanced_Sidebar_Menu\Notice;
35
  use Advanced_Sidebar_Menu\Scripts;
36
  use Advanced_Sidebar_Menu\Traits\Memoize;
37
  use Advanced_Sidebar_Menu\Traits\Singleton;
 
38
  use Advanced_Sidebar_Menu\Walkers\Page_Walker;
39
  use Advanced_Sidebar_Menu\Widget\Category as Widget_Category;
40
  use Advanced_Sidebar_Menu\Widget\Page as Widget_Page;
@@ -92,6 +93,7 @@ function advanced_sidebar_menu_autoload( $class ) {
92
  Singleton::class => 'Traits/Singleton.php',
93
 
94
  // Walkers.
 
95
  Page_Walker::class => 'Walkers/Page_Walker.php',
96
 
97
  ];
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.4.0
8
  * Author URI: https://onpointplugins.com
9
  * Text Domain: advanced-sidebar-menu
10
  * Domain Path: /languages/
19
  return;
20
  }
21
 
22
+ define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '8.4.0' );
23
  define( 'ADVANCED_SIDEBAR_MENU_REQUIRED_PRO_VERSION', '8.2.0' );
24
  define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
25
  define( 'ADVANCED_SIDEBAR_MENU_URL', plugin_dir_url( __FILE__ ) );
35
  use Advanced_Sidebar_Menu\Scripts;
36
  use Advanced_Sidebar_Menu\Traits\Memoize;
37
  use Advanced_Sidebar_Menu\Traits\Singleton;
38
+ use Advanced_Sidebar_Menu\Walkers\Category_Walker;
39
  use Advanced_Sidebar_Menu\Walkers\Page_Walker;
40
  use Advanced_Sidebar_Menu\Widget\Category as Widget_Category;
41
  use Advanced_Sidebar_Menu\Widget\Page as Widget_Page;
93
  Singleton::class => 'Traits/Singleton.php',
94
 
95
  // Walkers.
96
+ Category_Walker::class => 'Walkers/Category_Walker.php',
97
  Page_Walker::class => 'Walkers/Page_Walker.php',
98
 
99
  ];
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: menus, sidebar menu, hierarchy, category menu, pages menu, dynamic
6
  Requires at least: 5.2.0
7
  Tested up to: 5.7.2
8
  Requires PHP: 5.6.0
9
- Stable tag: 8.3.4
10
 
11
  == Description ==
12
 
@@ -155,12 +155,17 @@ Yes. Based on whatever page, post, or category you are on, the menu will change
155
 
156
 
157
  == Changelog ==
 
 
 
 
 
 
158
  = 8.3.4 =
159
  * Support widget fields with array values.
160
- * Minimum required version for PRO 8.4.0.
161
 
162
  = 8.3.3 =
163
- * Introduce `data-level` on all menu levels for specific targeting.
164
  * Tested to WordPress 5.7.2.
165
 
166
  = 8.3.2 =
@@ -249,7 +254,7 @@ Major version update. See <a href="https://onpointplugins.com/advanced-sidebar-m
249
  * Bump required PHP version to 5.4.4.
250
 
251
  == Upgrade Notice ==
252
- = 8.3.4 =
253
  Update to support PRO version 8.4.0.
254
 
255
  = 8.2.0 =
6
  Requires at least: 5.2.0
7
  Tested up to: 5.7.2
8
  Requires PHP: 5.6.0
9
+ Stable tag: 8.4.0
10
 
11
  == Description ==
12
 
155
 
156
 
157
  == Changelog ==
158
+ = 8.4.0 =
159
+ * Introduce new Category Walker to increase extensibility.
160
+ * Support `data-level` on all widgets.
161
+ * Complete preparations for PRO version 8.4.
162
+ * Minimum required version for PRO 8.4.
163
+
164
  = 8.3.4 =
165
  * Support widget fields with array values.
 
166
 
167
  = 8.3.3 =
168
+ * Introduce `data-level` on all page menu levels for specific targeting.
169
  * Tested to WordPress 5.7.2.
170
 
171
  = 8.3.2 =
254
  * Bump required PHP version to 5.4.4.
255
 
256
  == Upgrade Notice ==
257
+ = 8.4.0 =
258
  Update to support PRO version 8.4.0.
259
 
260
  = 8.2.0 =
src/Menus/Category.php CHANGED
@@ -3,6 +3,7 @@
3
  namespace Advanced_Sidebar_Menu\Menus;
4
 
5
  use Advanced_Sidebar_Menu\Core;
 
6
 
7
  /**
8
  * Category menu.
@@ -61,6 +62,7 @@ class Category extends Menu_Abstract {
61
  'show_option_none' => false,
62
  'taxonomy' => $this->get_taxonomy(),
63
  'title_li' => '',
 
64
  ];
65
 
66
  if ( null === $level ) {
3
  namespace Advanced_Sidebar_Menu\Menus;
4
 
5
  use Advanced_Sidebar_Menu\Core;
6
+ use Advanced_Sidebar_Menu\Walkers\Category_Walker;
7
 
8
  /**
9
  * Category menu.
62
  'show_option_none' => false,
63
  'taxonomy' => $this->get_taxonomy(),
64
  'title_li' => '',
65
+ 'walker' => new Category_Walker(),
66
  ];
67
 
68
  if ( null === $level ) {
src/Walkers/Category_Walker.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Advanced_Sidebar_Menu\Walkers;
4
+
5
+ /**
6
+ * Extend the default WP Category Walker.
7
+ *
8
+ * @since 8.4.0
9
+ */
10
+ class Category_Walker extends \Walker_Category {
11
+ /**
12
+ * Starts the list before the elements are added.
13
+ *
14
+ * Extended to include the `data-level`, otherwise default functionality.
15
+ *
16
+ * @param string $output Used to append additional content. Passed by reference.
17
+ * @param int $depth Optional. Depth of category. Used for tab indentation. Default 0.
18
+ * @param array $args Optional. An array of arguments. Will only append content if style argument
19
+ * value is 'list'. See wp_list_categories(). Default empty array.
20
+ */
21
+ public function start_lvl( &$output, $depth = 0, $args = [] ) {
22
+ if ( 'list' !== $args['style'] ) {
23
+ return;
24
+ }
25
+
26
+ $indent = str_repeat( "\t", $depth );
27
+ $level = $depth + 2;
28
+ $output .= "$indent<ul class='children' data-level='{$level}'>\n";
29
+ }
30
+ }
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.2
6
  *
7
  * To edit copy this file to a folder in your theme called 'advanced-sidebar-menu' and edit at will.
8
  *
@@ -19,14 +19,14 @@ $content = '';
19
 
20
  // Display parent category.
21
  if ( $current_menu->include_parent() ) {
22
- $content .= '<ul class="parent-sidebar-menu">';
23
 
24
  $list_args = $current_menu->get_list_categories_args( Category::LEVEL_PARENT );
25
  $content .= $current_menu->openListItem( wp_list_categories( $list_args ) );
26
  }
27
 
28
  if ( ! empty( $child_terms ) ) {
29
- $content .= '<ul class="child-sidebar-menu">';
30
 
31
  // Always display child categories.
32
  if ( $current_menu->display_all() ) {
@@ -41,7 +41,7 @@ if ( ! empty( $child_terms ) ) {
41
 
42
  // Grandchild terms.
43
  if ( $current_menu->is_current_term_ancestor( $_term ) && $current_menu->has_children( $_term ) ) {
44
- $content .= '<ul class="grandchild-sidebar-menu children">';
45
 
46
  $list_args = $current_menu->get_list_categories_args( Category::LEVEL_GRANDCHILD, $_term );
47
  $content .= wp_list_categories( $list_args );
2
  /**
3
  * The output of the "Advanced Sidebar Categories Menu" widget
4
  *
5
+ * @since 8.4.0
6
  *
7
  * To edit copy this file to a folder in your theme called 'advanced-sidebar-menu' and edit at will.
8
  *
19
 
20
  // Display parent category.
21
  if ( $current_menu->include_parent() ) {
22
+ $content .= '<ul class="parent-sidebar-menu" data-level="0">';
23
 
24
  $list_args = $current_menu->get_list_categories_args( Category::LEVEL_PARENT );
25
  $content .= $current_menu->openListItem( wp_list_categories( $list_args ) );
26
  }
27
 
28
  if ( ! empty( $child_terms ) ) {
29
+ $content .= '<ul class="child-sidebar-menu" data-level="1">';
30
 
31
  // Always display child categories.
32
  if ( $current_menu->display_all() ) {
41
 
42
  // Grandchild terms.
43
  if ( $current_menu->is_current_term_ancestor( $_term ) && $current_menu->has_children( $_term ) ) {
44
+ $content .= '<ul class="grandchild-sidebar-menu children" data-level="2">';
45
 
46
  $list_args = $current_menu->get_list_categories_args( Category::LEVEL_GRANDCHILD, $_term );
47
  $content .= wp_list_categories( $list_args );