Advanced Sidebar Menu - Version 4.1.0

Version Description

Download this release

Release Info

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

Code changes from version 4.0.1 to 4.1.0

advanced-sidebar-menu.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Advanced Sidebar Menu
4
  Plugin URI: http://lipeimagination.info/wordpress/advanced-sidebar-menu/
5
  Description: Creates dynamic menu based on child/parent relationship.
6
  Author: Mat Lipe
7
- Version: 4.0.1
8
  Author URI: http://lipeimagination.info
9
  Since: 4.5.13
10
  */
4
  Plugin URI: http://lipeimagination.info/wordpress/advanced-sidebar-menu/
5
  Description: Creates dynamic menu based on child/parent relationship.
6
  Author: Mat Lipe
7
+ Version: 4.1.0
8
  Author URI: http://lipeimagination.info
9
  Since: 4.5.13
10
  */
lib/advancedSidebarMenu.php CHANGED
@@ -4,7 +4,9 @@
4
  /**
5
  * These Functions are Specific to the Advanced Sidebar Menu
6
  * @author Mat Lipe
7
- * @since 4.5.13
 
 
8
  */
9
  class advancedSidebarMenu{
10
  var $instance; //The widget instance
@@ -15,12 +17,25 @@ class advancedSidebarMenu{
15
  var $order_by;
16
 
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  /**
19
  * The Old way of doing thing which displayed all 3rd levels and below when on a second level page
20
  * This is only here for people afraid of change who liked the old way of doing things
21
  *
22
  * @uses used in views -> page_list.php when legacy mode is checked in widget
23
- * @since 4.5.13
24
  */
25
  function grandChildLegacyMode($pID ){
26
  #-- if the link that was just listed is the current page we are on
@@ -30,11 +45,13 @@ class advancedSidebarMenu{
30
  $grandkids = $this->page_children($pID->ID );
31
  if( $grandkids ){
32
  #-- Create a new menu with all the children under it
33
- echo '<ul class="grandchild-sidebar-menu">';
34
- wp_list_pages("post_type=".$this->post_type."&sort_column=$order_by&title_li=&echo=1&exclude=".$this->instance['exclude']."&child_of=".$pID->ID);
35
 
36
- echo '</ul>';
37
  }
 
 
38
  }
39
 
40
 
@@ -48,9 +65,11 @@ class advancedSidebarMenu{
48
  *
49
  * @uses called by the widget view page_list.php
50
  * @since 4.0
 
 
51
  */
52
  function displayGrandChildMenu($page){
53
- static $count = 1;
54
  $count++;
55
 
56
  //If the page sent is not a child of the current page
@@ -59,7 +78,7 @@ class advancedSidebarMenu{
59
  //if there are no children of the current page bail
60
  if( !$children = $this->page_children($page->ID) ) return;
61
 
62
- printf('<ul class="grandchild-sidebar-menu level-%s">',$count );
63
  foreach( $children as $child ){
64
 
65
 
@@ -67,21 +86,25 @@ class advancedSidebarMenu{
67
  'post_type' => $this->post_type,
68
  'sort_column' => $this->order_by,
69
  'title_li' => '',
70
- 'echo' => 1,
71
  'depth' => 1,
72
  'exclude' => join(',',$this->exclude),
73
  'include' => $child->ID
74
  );
75
 
76
- wp_list_pages($args);
77
 
78
  //If this newly outputed child is a direct parent of the current page
79
  if( $this->page_ancestor($child) ){
80
- $this->displayGrandChildMenu($child);
81
  }
 
 
82
 
83
  }
84
- echo '</ul>';
 
 
85
 
86
  }
87
 
@@ -111,19 +134,6 @@ class advancedSidebarMenu{
111
  }
112
 
113
 
114
-
115
- /**
116
- * Sets the instance of this widget to this class
117
- * @param array $instance the widgets instance
118
- * @since 7/16/12
119
- */
120
- function set_widget_vars( $instance, $top_id, $exclude, $ancestors = array() ){
121
- $this->instance = $instance;
122
- $this->top_id = $top_id;
123
- $this->exclude = $exclude;
124
- $this->ancestors = $ancestors;
125
- }
126
-
127
  /**
128
  *
129
  * IF this is a top level category
@@ -215,11 +225,14 @@ class advancedSidebarMenu{
215
 
216
  /**
217
  * Echos the title of the widget to the page
218
- * @since 7/16/12
219
  */
220
  function title(){
221
  if( $this->instance['title'] != '' ){
222
- echo '<h4 class="widgettitle">' . $this->instance['title'] . '</h4>';
 
 
 
223
  }
224
 
225
  }
4
  /**
5
  * These Functions are Specific to the Advanced Sidebar Menu
6
  * @author Mat Lipe
7
+ * @since 4.7.13
8
+ *
9
+ * @package Advanced Sidebar Menu
10
  */
11
  class advancedSidebarMenu{
12
  var $instance; //The widget instance
17
  var $order_by;
18
 
19
 
20
+ /**
21
+ * Removes the closing </li> tag from a list item to allow for child menus inside of it
22
+ *
23
+ * @param string $item - an <li></li> item
24
+ * @return string|bool
25
+ * @since 4.7.13
26
+ */
27
+ function openListItem($item = false){
28
+ if( !$item ) return false;
29
+
30
+ return substr(trim($item), 0, -5);
31
+ }
32
+
33
  /**
34
  * The Old way of doing thing which displayed all 3rd levels and below when on a second level page
35
  * This is only here for people afraid of change who liked the old way of doing things
36
  *
37
  * @uses used in views -> page_list.php when legacy mode is checked in widget
38
+ * @since 4.7.13
39
  */
40
  function grandChildLegacyMode($pID ){
41
  #-- if the link that was just listed is the current page we are on
45
  $grandkids = $this->page_children($pID->ID );
46
  if( $grandkids ){
47
  #-- Create a new menu with all the children under it
48
+ $content .= '<ul class="grandchild-sidebar-menu">';
49
+ $content .= wp_list_pages("post_type=".$this->post_type."&sort_column=$order_by&title_li=&echo=0&exclude=".$this->instance['exclude']."&child_of=".$pID->ID);
50
 
51
+ $content .= '</ul>';
52
  }
53
+
54
+ return $content;
55
  }
56
 
57
 
65
  *
66
  * @uses called by the widget view page_list.php
67
  * @since 4.0
68
+ *
69
+ * @since 4.7.13
70
  */
71
  function displayGrandChildMenu($page){
72
+ static $count = 0;
73
  $count++;
74
 
75
  //If the page sent is not a child of the current page
78
  //if there are no children of the current page bail
79
  if( !$children = $this->page_children($page->ID) ) return;
80
 
81
+ $content .= sprintf('<ul class="grandchild-sidebar-menu level-%s children">',$count );
82
  foreach( $children as $child ){
83
 
84
 
86
  'post_type' => $this->post_type,
87
  'sort_column' => $this->order_by,
88
  'title_li' => '',
89
+ 'echo' => 0,
90
  'depth' => 1,
91
  'exclude' => join(',',$this->exclude),
92
  'include' => $child->ID
93
  );
94
 
95
+ $content .= $this->openListItem(wp_list_pages($args));
96
 
97
  //If this newly outputed child is a direct parent of the current page
98
  if( $this->page_ancestor($child) ){
99
+ $content .= $this->displayGrandChildMenu($child);
100
  }
101
+
102
+ $content .= '</li>';
103
 
104
  }
105
+ $content .= '</ul>';
106
+
107
+ return $content;
108
 
109
  }
110
 
134
  }
135
 
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  /**
138
  *
139
  * IF this is a top level category
225
 
226
  /**
227
  * Echos the title of the widget to the page
228
+ * @since 4.7.13
229
  */
230
  function title(){
231
  if( $this->instance['title'] != '' ){
232
+
233
+ $title = apply_filters('widget_title', $this->instance['title'], $this->args, $this->instance );
234
+
235
+ echo '<h4 class="widgettitle">' . $title . '</h4>';
236
  }
237
 
238
  }
readme.txt CHANGED
@@ -4,12 +4,12 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypa
4
  Tags: menus, sidebar menu, heirchy, category menu, pages menu
5
  Requires at least: 3.1
6
  Tested up to: 3.5.1
7
- Stable tag: 4.0.1
8
 
9
  Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
10
 
11
  == Description ==
12
- <h3>Now Supports an Unlimited Levels of Pages</h3>
13
 
14
  Creates a widget for both page and categories that will display the current page/category and an child pages or categories.
15
  Keeps the menu clean and usable.
4
  Tags: menus, sidebar menu, heirchy, category menu, pages menu
5
  Requires at least: 3.1
6
  Tested up to: 3.5.1
7
+ Stable tag: 4.1.0
8
 
9
  Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
10
 
11
  == Description ==
12
+ <h4>Now Supports an Unlimited Levels of Pages</h4>
13
 
14
  Creates a widget for both page and categories that will display the current page/category and an child pages or categories.
15
  Keeps the menu clean and usable.
views/category_list.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * The Ouput of tad Advanced Sidebar Categories Widget
5
  * @author Mat Lipe
6
- * @since 7/16/12
7
  *
8
  *
9
  * @uses to edit create a file named category_list.php and put in a folder in the your child theme called 'advanced-sidebar-menu
@@ -15,20 +15,20 @@
15
  //Displays the title
16
  $asm->title();
17
 
 
18
  //Include the parent page if chosen
19
  if( $asm->include_parent() ){
20
- echo '<ul class="parent-sidebar-menu">';
21
- wp_list_categories( 'title_li=&include=' . $top_cat);
22
  }
23
  //If there are children to display
24
  if( !empty($all_categories) ){
25
- echo '<ul class="child-sidebar-menu">';
26
 
27
  #-- If they want all the child categories displayed always
28
  if( $asm->display_all() ){
29
- wp_list_categories('title_li=&child_of=' . $top_cat .'&depth=' .$instance['levels'] );
30
- echo '</ul><!-- End #child-sidebar-menu -->';
31
-
32
  } else {
33
 
34
  #-- to Display the categories based a parent child relationship
@@ -38,28 +38,34 @@ if( $asm->include_parent() ){
38
  if( $asm->first_level_category( $child_cat ) ){
39
 
40
  //List the child category and the children if it is the current one
41
- wp_list_categories('title_li=&include=' . $child_cat->cat_ID . '&depth=1' );
42
 
43
 
44
  //If there are children of this cat and it is a parent or child or the current cat
45
  if( $asm->second_level_cat( $child_cat ) ){
46
  #-- Create a new menu with all the children under it
47
- echo '<ul class="grandchild-sidebar-menu">';
48
- wp_list_categories("title_li=&exclude=".$instance['exclude']."&depth=3&child_of=" .$child_cat->cat_ID );
49
- echo '</ul>';
50
 
51
  }
 
 
52
  }
53
  } //End foreach
54
 
55
- echo '</ul><!-- End #child-sidebar-menu -->';
56
 
57
  } //End if display all is not checked
58
 
 
 
59
  } //End if the are child categories
60
 
61
 
62
  #-- if a parent category was displayed
63
  if( $asm->include_parent() ){
64
- echo '</ul><!-- End #parent-sidebar-menu -->';
65
- }
 
 
3
  /**
4
  * The Ouput of tad Advanced Sidebar Categories Widget
5
  * @author Mat Lipe
6
+ * @since 4.1.0
7
  *
8
  *
9
  * @uses to edit create a file named category_list.php and put in a folder in the your child theme called 'advanced-sidebar-menu
15
  //Displays the title
16
  $asm->title();
17
 
18
+
19
  //Include the parent page if chosen
20
  if( $asm->include_parent() ){
21
+ $content .= '<ul class="parent-sidebar-menu">';
22
+ $content .= $asm->openListItem( wp_list_categories( 'echo=0&title_li=&include=' . $top_cat) );
23
  }
24
  //If there are children to display
25
  if( !empty($all_categories) ){
26
+ $content .= '<ul class="child-sidebar-menu">';
27
 
28
  #-- If they want all the child categories displayed always
29
  if( $asm->display_all() ){
30
+ $content .= wp_list_categories('echo=0&title_li=&child_of=' . $top_cat .'&depth=' .$instance['levels'] );
31
+
 
32
  } else {
33
 
34
  #-- to Display the categories based a parent child relationship
38
  if( $asm->first_level_category( $child_cat ) ){
39
 
40
  //List the child category and the children if it is the current one
41
+ $content .= $asm->openListItem(wp_list_categories('echo=0&title_li=&include=' . $child_cat->cat_ID . '&depth=1' ) );
42
 
43
 
44
  //If there are children of this cat and it is a parent or child or the current cat
45
  if( $asm->second_level_cat( $child_cat ) ){
46
  #-- Create a new menu with all the children under it
47
+ $content .= '<ul class="grandchild-sidebar-menu">';
48
+ $content .= wp_list_categories("echo=0&title_li=&exclude=".$instance['exclude']."&depth=3&child_of=" .$child_cat->cat_ID );
49
+ $content .= '</ul>';
50
 
51
  }
52
+
53
+ $content .= '</li>';
54
  }
55
  } //End foreach
56
 
57
+
58
 
59
  } //End if display all is not checked
60
 
61
+ $content .= '</ul><!-- End #child-sidebar-menu -->';
62
+
63
  } //End if the are child categories
64
 
65
 
66
  #-- if a parent category was displayed
67
  if( $asm->include_parent() ){
68
+ $content .= '</li>
69
+ </ul><!-- End #parent-sidebar-menu -->';
70
+ }
71
+
views/page_list.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * The Ouput of the Advanced Sidebar Page Widget
4
  * @author Mat Lipe
5
- * @since 4.0.0
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
@@ -12,21 +12,23 @@
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
 
22
  //If there are children start the Child Sidebar Menu
23
  if( $child_pages ){
24
- echo '<ul class="child-sidebar-menu">';
25
 
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
@@ -35,26 +37,27 @@ if( $child_pages ){
35
  #-- If the page is not in the excluded ones
36
  if( $asm->exclude( $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( !$instance['legacy_mode'] ){
42
- #-- Displays all levels of granchild pages related to the current page
43
- $asm->displayGrandChildMenu($pID);
44
- } else{
45
- $asm->grandChildLegacyMode($pID);
46
- }
 
47
 
48
-
49
  }
50
  }
51
 
52
  #-- Close the First Level menu
53
- echo '</ul><!-- End child-sidebar-menu -->';
54
 
55
  }
56
  if( $asm->include_parent() ) {
57
- echo '</ul><!-- .parent-sidebar-menu -->';
58
  }
59
 
60
 
2
  /**
3
  * The Ouput of the Advanced Sidebar Page Widget
4
  * @author Mat Lipe
5
+ * @since 4.1.0
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
12
 
13
  $asm->title();
14
 
15
+ $content = '';
16
+
17
  #-- list the parent page if chosen
18
  if( $asm->include_parent() ){
19
+ $content .= '<ul class="parent-sidebar-menu" >';
20
+ $content .= $asm->openListItem(wp_list_pages("post_type=".$post_type."&sort_column=$order_by&title_li=&echo=0&depth=1&include=".$top_parent) );
21
  }
22
 
23
 
24
  //If there are children start the Child Sidebar Menu
25
  if( $child_pages ){
26
+ $content .= '<ul class="child-sidebar-menu">';
27
 
28
  #-- If they want all the pages displayed always
29
  if( $asm->display_all() ){
30
 
31
+ $content .= wp_list_pages("post_type=".$post_type."&sort_column=$order_by&title_li=&echo=0&child_of=".$top_parent."&depth=".$instance['levels']."&exclude=".$instance['exclude']);
32
  } else {
33
 
34
  #-- Display children of current page's parent only
37
  #-- If the page is not in the excluded ones
38
  if( $asm->exclude( $pID->ID) ){
39
  #--echo the current page from the $result
40
+ $content .= $asm->openListItem(wp_list_pages("post_type=".$post_type."&sort_column=$order_by&title_li=&echo=0&depth=1&include=".$pID->ID));
41
+ } else {
42
+ continue;
43
+ }
44
+ if( !$instance['legacy_mode'] ){
45
+ #-- Displays all levels of granchild pages related to the current page
46
+ $content .= $asm->displayGrandChildMenu($pID);
47
+ } else{
48
+ $content .= $asm->grandChildLegacyMode($pID);
49
+ }
50
 
51
+ $content .= '</li>';
52
  }
53
  }
54
 
55
  #-- Close the First Level menu
56
+ $content .= '</ul><!-- End child-sidebar-menu -->';
57
 
58
  }
59
  if( $asm->include_parent() ) {
60
+ $content .= '</li></ul><!-- .parent-sidebar-menu -->';
61
  }
62
 
63
 
views/sidebar-menu.css CHANGED
@@ -22,6 +22,7 @@
22
  .advanced-sidebar-menu ul li{
23
  list-style:none;
24
  list-style-type: none;
 
25
 
26
  }
27
 
22
  .advanced-sidebar-menu ul li{
23
  list-style:none;
24
  list-style-type: none;
25
+ margin: 0;
26
 
27
  }
28
 
widgets/category.widget.php CHANGED
@@ -5,15 +5,26 @@
5
  * Creates a Widget of parent Child Categories
6
  *
7
  * @author mat lipe
8
- * @since 10.12.12
9
  * @package Advanced Sidebar Menu
10
  *
11
  */
 
12
 
13
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
 
16
- class advanced_sidebar_menu_category extends WP_Widget {
17
 
18
  #-----------------------------------------------------------------------------------------------------------------------------------
19
  // this creates the widget form for the dashboard
@@ -112,30 +123,31 @@ class advanced_sidebar_menu_category extends WP_Widget {
112
  return $instance;
113
  }
114
 
115
- #-------------------------------------------------------------------------------------------------------------------------
116
 
117
- // This decides the name of the widget
118
- function advanced_sidebar_menu_category( ) {
119
- /* Widget settings. */
120
- $widget_ops = array( 'classname' => 'advanced-sidebar-menu advanced-sidebar-category', 'description' => 'Creates a menu of all the Categories using the child/parent relationship' );
121
- $control_ops = array( 'width' => 290 );
122
- /* Create the widget. */
123
- $this->WP_Widget( 'advanced_sidebar_menu_category', 'Advanced Sidebar Categories Menu', $widget_ops, $control_ops );
124
- }
125
 
126
 
127
  #---------------------------------------------------------------------------------------------------------------------------
128
 
129
  /**
130
  * Outputs the categories widget to the page
131
- * @since 3.6.13
 
 
 
 
132
  *
133
  */
134
  function widget($args, $instance) {
135
  $asm = new advancedSidebarMenu;
 
 
 
 
 
 
136
  extract( $args);
137
  #-- Create a usable array of the excluded pages
138
- $exclude = explode(',', $instance['exclude']);
139
  $cat_ids = $already_top = array();
140
  $asm_once = $asm_cat_widget_count = false; //keeps track of how many widgets this created
141
  $count = null;
@@ -154,10 +166,6 @@ class advanced_sidebar_menu_category extends WP_Widget {
154
  $cat_ids[] = get_query_var('cat');
155
  }
156
 
157
- //print_r( get_the_category() );
158
-
159
- ///print_r( $cat_ids );
160
-
161
  //Bring in the Styling
162
  if( $instance['css'] == 'checked' ){
163
  echo '<style type="text/css">';
@@ -179,8 +187,11 @@ class advanced_sidebar_menu_category extends WP_Widget {
179
 
180
  //Reverse the array to start at the last
181
  $cat_ancestors = array_reverse( $cat_ancestors );
 
 
182
  //forget the [0] because the parent of top parent is always 0
183
  $top_cat = $cat_ancestors[1];
 
184
 
185
 
186
  //Keeps track or already used top levels so this won't double up
@@ -213,12 +224,12 @@ class advanced_sidebar_menu_category extends WP_Widget {
213
  } else {
214
  $close = false;
215
  }
216
-
217
- $asm->set_widget_vars( $instance, $top_cat, $exclude, $cat_ancestors );
218
  //Bring in the view
219
  require( $asm->file_hyercy( 'category_list.php' ) );
220
-
221
-
 
222
  if( $close ){
223
  //End the Widget Area
224
  echo $after_widget;
5
  * Creates a Widget of parent Child Categories
6
  *
7
  * @author mat lipe
8
+ * @since 4.1.0
9
  * @package Advanced Sidebar Menu
10
  *
11
  */
12
+ class advanced_sidebar_menu_category extends WP_Widget {
13
 
14
 
15
+ #-------------------------------------------------------------------------------------------------------------------------
16
+
17
+ // This decides the name of the widget
18
+ function __construct() {
19
+ /* Widget settings. */
20
+ $widget_ops = array( 'classname' => 'advanced-sidebar-menu advanced-sidebar-category', 'description' => 'Creates a menu of all the Categories using the child/parent relationship' );
21
+ $control_ops = array( 'width' => 290 );
22
+ /* Create the widget. */
23
+ $this->WP_Widget( 'advanced_sidebar_menu_category', 'Advanced Sidebar Categories Menu', $widget_ops, $control_ops );
24
+ }
25
+
26
 
27
 
 
28
 
29
  #-----------------------------------------------------------------------------------------------------------------------------------
30
  // this creates the widget form for the dashboard
123
  return $instance;
124
  }
125
 
 
126
 
 
 
 
 
 
 
 
 
127
 
128
 
129
  #---------------------------------------------------------------------------------------------------------------------------
130
 
131
  /**
132
  * Outputs the categories widget to the page
133
+ *
134
+ * @since 4.7.13
135
+ * @uses loads the views/category_list.php
136
+ *
137
+ * @filters apply_filters('advanced_sidebar_menu_category_widget_output', $content, $args, $instance );
138
  *
139
  */
140
  function widget($args, $instance) {
141
  $asm = new advancedSidebarMenu;
142
+ $asm->instance = $instance;
143
+ $asm->args = $args;
144
+
145
+ $exclude = explode(',', $instance['exclude']);
146
+ $asm->exclude = $exclude;
147
+
148
  extract( $args);
149
  #-- Create a usable array of the excluded pages
150
+
151
  $cat_ids = $already_top = array();
152
  $asm_once = $asm_cat_widget_count = false; //keeps track of how many widgets this created
153
  $count = null;
166
  $cat_ids[] = get_query_var('cat');
167
  }
168
 
 
 
 
 
169
  //Bring in the Styling
170
  if( $instance['css'] == 'checked' ){
171
  echo '<style type="text/css">';
187
 
188
  //Reverse the array to start at the last
189
  $cat_ancestors = array_reverse( $cat_ancestors );
190
+ $asm->ancestors = $cat_ancestors;
191
+
192
  //forget the [0] because the parent of top parent is always 0
193
  $top_cat = $cat_ancestors[1];
194
+ $asm->top_id = $top_cat;
195
 
196
 
197
  //Keeps track or already used top levels so this won't double up
224
  } else {
225
  $close = false;
226
  }
227
+
 
228
  //Bring in the view
229
  require( $asm->file_hyercy( 'category_list.php' ) );
230
+
231
+ echo apply_filters('advanced_sidebar_menu_category_widget_output', $content, $args, $instance );
232
+
233
  if( $close ){
234
  //End the Widget Area
235
  echo $after_widget;
widgets/page.widget.php CHANGED
@@ -5,7 +5,7 @@
5
  * Creates a Widget of parent Child Pages
6
  *
7
  * @author mat lipe
8
- * @since 4.5.13
9
  * @package Advanced Sidebar Menu
10
  *
11
  */
@@ -32,7 +32,7 @@ class advanced_sidebar_menu_page extends WP_Widget {
32
  * Not of ton of options here but who need them
33
  * Most of the magic happens automatically
34
  *
35
- * @since 4.5.13
36
  */
37
  function form( $instance ) {
38
  ?>
@@ -49,7 +49,7 @@ class advanced_sidebar_menu_page extends WP_Widget {
49
  name="<?php echo $this->get_field_name('include_childless_parent'); ?>" type="checkbox" value="checked"
50
  <?php echo $instance['include_childless_parent']; ?>/></p>
51
 
52
- <p> Use Built in Styling: <input id="<?php echo $this->get_field_name('css'); ?>"
53
  name="<?php echo $this->get_field_name('css'); ?>" type="checkbox" value="checked"
54
  <?php echo $instance['css']; ?>/></p>
55
 
@@ -108,17 +108,28 @@ class advanced_sidebar_menu_page extends WP_Widget {
108
  * @uses change the top parent manually with the filter 'advanced_sidebar_menu_top_parent'
109
  * @uses change the order of the 2nd level pages with 'advanced_sidebar_menu_order_by' filter
110
  *
111
- * @since 4.5.13
 
 
 
 
 
 
112
  */
113
  function widget($args, $instance) {
114
  global $wpdb, $post, $table_prefix;
 
 
 
 
115
  $asm = new advancedSidebarMenu;
116
 
117
  $asm->instance = $instance;
 
118
  extract($args);
119
 
120
  //Filter this one with a 'single' for a custom post type will default to working for pages only
121
- $post_type = apply_filters('advanced_sidebar_menu_post_type', 'page' );
122
  $asm->post_type = $post_type;
123
 
124
  if( $post_type != 'page' ){
@@ -143,12 +154,12 @@ class advanced_sidebar_menu_page extends WP_Widget {
143
 
144
 
145
  //Filter for specifying the top parent
146
- $top_parent = apply_filters('advanced_sidebar_menu_top_parent', $top_parent, $post );
147
  $asm->top_id = $top_parent;
148
 
149
 
150
  //Filter for specifiying the order by
151
- $order_by = apply_filters('advanced_sidebar_menu_order_by', 'menu_order', $post );
152
  $asm->order_by = $order_by;
153
 
154
 
@@ -173,10 +184,11 @@ class advanced_sidebar_menu_page extends WP_Widget {
173
 
174
  //Start the menu
175
  echo $before_widget;
176
-
177
- #-- Bring in the view
178
- require( $asm->file_hyercy( 'page_list.php' ) );
179
  echo $after_widget;
 
180
  }
181
 
182
  } #== /widget()
5
  * Creates a Widget of parent Child Pages
6
  *
7
  * @author mat lipe
8
+ * @since 4.7.13
9
  * @package Advanced Sidebar Menu
10
  *
11
  */
32
  * Not of ton of options here but who need them
33
  * Most of the magic happens automatically
34
  *
35
+ * @since 4.7.13
36
  */
37
  function form( $instance ) {
38
  ?>
49
  name="<?php echo $this->get_field_name('include_childless_parent'); ?>" type="checkbox" value="checked"
50
  <?php echo $instance['include_childless_parent']; ?>/></p>
51
 
52
+ <p> Use this Plugin's Styling: <input id="<?php echo $this->get_field_name('css'); ?>"
53
  name="<?php echo $this->get_field_name('css'); ?>" type="checkbox" value="checked"
54
  <?php echo $instance['css']; ?>/></p>
55
 
108
  * @uses change the top parent manually with the filter 'advanced_sidebar_menu_top_parent'
109
  * @uses change the order of the 2nd level pages with 'advanced_sidebar_menu_order_by' filter
110
  *
111
+ * @filter apply_filters('advanced_sidebar_menu_page_widget_output',$content, $args, $instance );
112
+ * apply_filters('advanced_sidebar_menu_order_by', 'menu_order', $post, $args, $instance );
113
+ * apply_filters('advanced_sidebar_menu_top_parent', $top_parent, $post, $args, $instance );
114
+ * apply_filters('advanced_sidebar_menu_post_type', 'page', $args, $instance );
115
+ *
116
+ *
117
+ * @since 4.7.13
118
  */
119
  function widget($args, $instance) {
120
  global $wpdb, $post, $table_prefix;
121
+
122
+ //There will be no pages to generate on an archive page
123
+ if( is_archive() ) return;
124
+
125
  $asm = new advancedSidebarMenu;
126
 
127
  $asm->instance = $instance;
128
+ $asm->args = $args;
129
  extract($args);
130
 
131
  //Filter this one with a 'single' for a custom post type will default to working for pages only
132
+ $post_type = apply_filters('advanced_sidebar_menu_post_type', 'page', $args, $instance );
133
  $asm->post_type = $post_type;
134
 
135
  if( $post_type != 'page' ){
154
 
155
 
156
  //Filter for specifying the top parent
157
+ $top_parent = apply_filters('advanced_sidebar_menu_top_parent', $top_parent, $post, $args, $instance );
158
  $asm->top_id = $top_parent;
159
 
160
 
161
  //Filter for specifiying the order by
162
+ $order_by = apply_filters('advanced_sidebar_menu_order_by', 'menu_order', $post, $args, $instance );
163
  $asm->order_by = $order_by;
164
 
165
 
184
 
185
  //Start the menu
186
  echo $before_widget;
187
+ #-- Bring in the view
188
+ require( $asm->file_hyercy( 'page_list.php' ) );
189
+ echo apply_filters('advanced_sidebar_menu_page_widget_output',$content, $args, $instance );
190
  echo $after_widget;
191
+
192
  }
193
 
194
  } #== /widget()