Advanced Sidebar Menu - Version 5.1.2

Version Description

Download this release

Release Info

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

Code changes from version 5.1.1 to 5.1.2

advanced-sidebar-menu.php CHANGED
@@ -2,14 +2,14 @@
2
  /*
3
  Plugin Name: Advanced Sidebar Menu
4
  Plugin URI: https://matlipe.com/advanced-sidebar-menu/
5
- Description: Creates dynamic menu based on child/parent relationship.
6
  Author: Mat Lipe
7
- Version: 5.1.1
8
  Author URI: https://matlipe.com
9
  Text Domain: advanced-sidebar-menu
10
  */
11
 
12
- define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '5.1.1' );
13
 
14
 
15
  #-- Define Constants
2
  /*
3
  Plugin Name: Advanced Sidebar Menu
4
  Plugin URI: https://matlipe.com/advanced-sidebar-menu/
5
+ Description: Creates dynamic menus based on parent/child relationship of your pages or categories.
6
  Author: Mat Lipe
7
+ Version: 5.1.2
8
  Author URI: https://matlipe.com
9
  Text Domain: advanced-sidebar-menu
10
  */
11
 
12
+ define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '5.1.2' );
13
 
14
 
15
  #-- Define Constants
legacy/page_list.php CHANGED
@@ -1,21 +1,26 @@
1
  <?php
2
  /**
3
  * The Ouput of the Advanced Sidebar Page Widget
 
4
  * @author Mat Lipe
5
- * @since 3.1.13
6
  *
 
7
  *
8
- * @uses to edit, create a file named page_list.php and put in a folder in the your theme called 'advanced-sidebar-menu
9
- * @uses copy the contents of the file into that file and edit at will
10
- * @uses Do not edit this file in its original location or it will break on upgrade
 
11
  */
12
 
 
 
13
  $asm->title();
14
 
15
  #-- list the parent page if chosen
16
  if( $asm->include_parent() ){
17
  echo '<ul class="parent-sidebar-menu" >';
18
- wp_list_pages("post_type=".$post_type."&sort_column=$order_by&title_li=&echo=1&depth=1&include=".$top_parent);
19
  }
20
 
21
 
@@ -26,16 +31,16 @@ if( $child_pages ){
26
  #-- If they want all the pages displayed always
27
  if( $asm->display_all() ){
28
 
29
- wp_list_pages("post_type=".$post_type."&sort_column=$order_by&title_li=&echo=1&child_of=".$top_parent."&depth=".$instance['levels']."&exclude=".$instance['exclude']);
30
  } else {
31
 
32
  #-- Display children of current page's parent only
33
- foreach($result as $pID){
34
 
35
  #-- If the page is not in the excluded ones
36
  if( $asm->is_excluded( $pID->ID) ){
37
  #--echo the current page from the $result
38
- wp_list_pages("post_type=".$post_type."&sort_column=$order_by&title_li=&echo=1&depth=1&include=".$pID->ID);
39
  }
40
 
41
  #-- if the link that was just listed is the current page we are on
@@ -46,7 +51,7 @@ if( $child_pages ){
46
  if( $grandkids ){
47
  #-- Create a new menu with all the children under it
48
  echo '<ul class="grandchild-sidebar-menu">';
49
- wp_list_pages("post_type=".$post_type."&sort_column=$order_by&title_li=&echo=1&exclude=".$instance['exclude']."&child_of=".$pID->ID);
50
 
51
  echo '</ul>';
52
  }
1
  <?php
2
  /**
3
  * The Ouput of the Advanced Sidebar Page Widget
4
+ *
5
  * @author Mat Lipe
6
+ * @deprecated 3.1.13
7
  *
8
+ * @see views/page_list.php which is the files used when not using legacy mode
9
  *
10
+ * @example to edit, create a file named page_list.php and put in a folder in the your theme called 'advanced-sidebar-menu.
11
+ * Copy the contents of the file into that file and edit at will.
12
+ * Select Legacy in the widget options.
13
+ * @notice Do not edit this file in its original location or it will break on upgrade
14
  */
15
 
16
+
17
+ /** @var advancedSidebarMenu $asm */
18
  $asm->title();
19
 
20
  #-- list the parent page if chosen
21
  if( $asm->include_parent() ){
22
  echo '<ul class="parent-sidebar-menu" >';
23
+ wp_list_pages("post_type=".$asm->post_type."&sort_column=$asm->order_by&title_li=&echo=1&depth=1&include=".$asm->top_id);
24
  }
25
 
26
 
31
  #-- If they want all the pages displayed always
32
  if( $asm->display_all() ){
33
 
34
+ wp_list_pages("post_type=".$asm->post_type."&sort_column=$asm->order_by&title_li=&echo=1&child_of=".$asm->top_id."&depth=".$instance['levels']."&exclude=".$instance['exclude']);
35
  } else {
36
 
37
  #-- Display children of current page's parent only
38
+ foreach($child_pages as $pID){
39
 
40
  #-- If the page is not in the excluded ones
41
  if( $asm->is_excluded( $pID->ID) ){
42
  #--echo the current page from the $result
43
+ wp_list_pages("post_type=".$asm->post_type."&sort_column=$asm->order_by&title_li=&echo=1&depth=1&include=".$pID->ID);
44
  }
45
 
46
  #-- if the link that was just listed is the current page we are on
51
  if( $grandkids ){
52
  #-- Create a new menu with all the children under it
53
  echo '<ul class="grandchild-sidebar-menu">';
54
+ wp_list_pages("post_type=".$asm->post_type."&sort_column=$asm->order_by&title_li=&echo=1&exclude=".$instance['exclude']."&child_of=".$pID->ID);
55
 
56
  echo '</ul>';
57
  }
readme.txt CHANGED
@@ -4,20 +4,22 @@ Contributors: Mat Lipe
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40matlipe%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.2.0
7
- Tested up to: 4.4.1
8
- Stable tag: 5.1.1
9
 
10
  == Description ==
11
 
12
- Creates a widget for both pages and categories that will display the current page/category and an child pages or categories.
13
- Keeps the menu clean and usable.
 
 
14
 
15
  <h3>Want more options and better support?</h3>
16
 
17
  <strong><big><a href="https://matlipe.com/product/advanced-sidebar-menu-pro/">Go Pro!</a></big></strong>
18
 
19
 
20
- Included page options:
21
  <ol>
22
  <li>Add a title to the widget</li>
23
  <li>Include the highest level parent page</li>
@@ -29,7 +31,8 @@ Included page options:
29
  <li>Always display child Pages</li>
30
  <li>Number of levels of child pages to display</li>
31
  </ol>
32
- Included category options:
 
33
  <ol>
34
  <li>Add a title to the widget</li>
35
  <li>Include Parent Category</li>
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40matlipe%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.2.0
7
+ Tested up to: 4.4.2
8
+ Stable tag: 5.1.2
9
 
10
  == Description ==
11
 
12
+ Uses the parent/child relationship of your pages or categories to generate menus based on the current section of your site. Simply assign a page or category to a parent and this will do the rest for you.
13
+
14
+ Keeps the menu clean and usable. Only related items display so you don't have to worry about keeping a custom menu up to date or displaying links to items that don't belong.
15
+
16
 
17
  <h3>Want more options and better support?</h3>
18
 
19
  <strong><big><a href="https://matlipe.com/product/advanced-sidebar-menu-pro/">Go Pro!</a></big></strong>
20
 
21
 
22
+ <h4>Included page options:</h4>
23
  <ol>
24
  <li>Add a title to the widget</li>
25
  <li>Include the highest level parent page</li>
31
  <li>Always display child Pages</li>
32
  <li>Number of levels of child pages to display</li>
33
  </ol>
34
+
35
+ <h4>Included category options:</h4>
36
  <ol>
37
  <li>Add a title to the widget</li>
38
  <li>Include Parent Category</li>
views/page_list.php CHANGED
@@ -6,11 +6,12 @@
6
  *
7
  * @since 5.0.0
8
  *
9
- * @uses to edit, create a file named page_list.php and put in a folder in the your theme called 'advanced-sidebar-menu
10
- * @uses copy the contents of the file into that file and edit at will
11
- * @uses Do not edit this file in its original location or it will break on upgrade
12
  */
13
 
 
14
  $asm->title();
15
 
16
  #-- list the parent page if chosen
6
  *
7
  * @since 5.0.0
8
  *
9
+ * @example to edit, create a file named page_list.php and put in a folder in the your theme called 'advanced-sidebar-menu.
10
+ * Copy the contents of the file into that file and edit at will.
11
+ * @notice Do not edit this file in its original location or it will break on upgrade
12
  */
13
 
14
+ /** @var advancedSidebarMenu $asm */
15
  $asm->title();
16
 
17
  #-- list the parent page if chosen
widgets/page.widget.php CHANGED
@@ -236,6 +236,8 @@ class advanced_sidebar_menu_page extends WP_Widget {
236
  $asm->order_by = $order_by = apply_filters_ref_array( 'advanced_sidebar_menu_order_by', $filter_args );
237
 
238
  $child_pages = $this->get_child_pages( $asm, $filter_args );
 
 
239
 
240
  #---- if there are no children do not display the parent unless it is check to do so
241
  if( ( !empty( $child_pages ) ) || $asm->checked( 'include_childless_parent' ) && ( !in_array( $top_parent, $asm->exclude ) ) ){
236
  $asm->order_by = $order_by = apply_filters_ref_array( 'advanced_sidebar_menu_order_by', $filter_args );
237
 
238
  $child_pages = $this->get_child_pages( $asm, $filter_args );
239
+ //backward compatibility
240
+ $result = $child_pages;
241
 
242
  #---- if there are no children do not display the parent unless it is check to do so
243
  if( ( !empty( $child_pages ) ) || $asm->checked( 'include_childless_parent' ) && ( !in_array( $top_parent, $asm->exclude ) ) ){