Version Description
Download this release
Release Info
Developer | Mat Lipe |
Plugin | Advanced Sidebar Menu |
Version | 4.1.3 |
Comparing to | |
See all releases |
Code changes from version 4.1.2 to 4.1.3
- advanced-sidebar-menu.php +1 -1
- lib/advancedSidebarMenu.php +56 -7
- readme.txt +10 -6
- sidebar-menu.css +35 -0
- views/category_list.php +7 -4
- views/page_list.php +4 -7
- widgets/category.widget.php +162 -173
- widgets/page.widget.php +99 -88
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.1.
|
8 |
Author URI: http://lipeimagination.info
|
9 |
Since: 4.23.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.3
|
8 |
Author URI: http://lipeimagination.info
|
9 |
Since: 4.23.13
|
10 |
*/
|
lib/advancedSidebarMenu.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
/**
|
5 |
* These Functions are Specific to the Advanced Sidebar Menu
|
6 |
* @author Mat Lipe
|
7 |
-
* @since
|
8 |
*
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*/
|
@@ -17,6 +17,53 @@ class advancedSidebarMenu{
|
|
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 |
*
|
@@ -170,10 +217,13 @@ class advancedSidebarMenu{
|
|
170 |
|
171 |
/**
|
172 |
* Determines if all the children should be included
|
173 |
-
* @since
|
174 |
* @return bool
|
175 |
*/
|
176 |
function display_all(){
|
|
|
|
|
|
|
177 |
if( $this->instance['display_all'] == 'checked' ){
|
178 |
return true;
|
179 |
} else {
|
@@ -211,10 +261,11 @@ class advancedSidebarMenu{
|
|
211 |
|
212 |
/**
|
213 |
* Determines if the parent page or cat should be included
|
214 |
-
* @since
|
215 |
* @return bool
|
216 |
*/
|
217 |
function include_parent(){
|
|
|
218 |
if( ($this->instance['include_parent'] == 'checked') && (!in_array($this->top_id, $this->exclude)) ){
|
219 |
return true;
|
220 |
} else {
|
@@ -225,14 +276,12 @@ class advancedSidebarMenu{
|
|
225 |
|
226 |
/**
|
227 |
* Echos the title of the widget to the page
|
228 |
-
* @since
|
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 |
}
|
4 |
/**
|
5 |
* These Functions are Specific to the Advanced Sidebar Menu
|
6 |
* @author Mat Lipe
|
7 |
+
* @since 5.19.13
|
8 |
*
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*/
|
17 |
var $order_by;
|
18 |
|
19 |
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Checks if a widgets checkbox is checked.
|
23 |
+
* * this one is special and does a double check
|
24 |
+
*
|
25 |
+
* @since 4.1.3
|
26 |
+
*
|
27 |
+
* @param string $name - name of checkbox
|
28 |
+
*/
|
29 |
+
function checked($name){
|
30 |
+
|
31 |
+
if( isset( $this->instance[$name] ) && $this->instance[$name] == 'checked' ) return true;
|
32 |
+
|
33 |
+
return false;
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Retrieves the Highest level Category Id
|
39 |
+
*
|
40 |
+
* @since 4.1.3
|
41 |
+
* @param int $catId - id of cat looking for top parent of
|
42 |
+
*
|
43 |
+
* @return int
|
44 |
+
*/
|
45 |
+
function getTopCat( $catId ){
|
46 |
+
$cat_ancestors = array();
|
47 |
+
$cat_ancestors[] = $catId ;
|
48 |
+
|
49 |
+
do {
|
50 |
+
$cat_id = get_category($cat_id);
|
51 |
+
$cat_id = $cat_id->parent;
|
52 |
+
$cat_ancestors[] = $cat_id;
|
53 |
+
}
|
54 |
+
while ($cat_id);
|
55 |
+
|
56 |
+
|
57 |
+
//Reverse the array to start at the last
|
58 |
+
$this->ancestors = array_reverse( $cat_ancestors );
|
59 |
+
|
60 |
+
//forget the [0] because the parent of top parent is always 0
|
61 |
+
return $this->ancestors[1];
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
/**
|
68 |
* Removes the closing </li> tag from a list item to allow for child menus inside of it
|
69 |
*
|
217 |
|
218 |
/**
|
219 |
* Determines if all the children should be included
|
220 |
+
* @since 5.19.13
|
221 |
* @return bool
|
222 |
*/
|
223 |
function display_all(){
|
224 |
+
|
225 |
+
if( !isset( $this->instance['display_all'] ) ) return false;
|
226 |
+
|
227 |
if( $this->instance['display_all'] == 'checked' ){
|
228 |
return true;
|
229 |
} else {
|
261 |
|
262 |
/**
|
263 |
* Determines if the parent page or cat should be included
|
264 |
+
* @since 5.19.13
|
265 |
* @return bool
|
266 |
*/
|
267 |
function include_parent(){
|
268 |
+
if( !isset( $this->instance['include_parent'] ) ) return false;
|
269 |
if( ($this->instance['include_parent'] == 'checked') && (!in_array($this->top_id, $this->exclude)) ){
|
270 |
return true;
|
271 |
} else {
|
276 |
|
277 |
/**
|
278 |
* Echos the title of the widget to the page
|
279 |
+
* @since 5.19.13
|
280 |
*/
|
281 |
function title(){
|
282 |
if( $this->instance['title'] != '' ){
|
|
|
283 |
$title = apply_filters('widget_title', $this->instance['title'], $this->args, $this->instance );
|
284 |
+
echo $this->args['before_title'] . $title . $this->args['after_title'];
|
|
|
285 |
}
|
286 |
|
287 |
}
|
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.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 |
-
<h4>Now Supports
|
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.
|
@@ -38,7 +38,9 @@ Includes Category Options:
|
|
38 |
<li>Levels of Categories to display</li>
|
39 |
</ol>
|
40 |
|
41 |
-
|
|
|
|
|
42 |
|
43 |
|
44 |
|
@@ -85,9 +87,6 @@ the folder you just created. You may edit the files at will to change the output
|
|
85 |
You must have the option checked to use the built in CSS (in the widget) to be able to edit the css file in this way.
|
86 |
The Others will work always.
|
87 |
|
88 |
-
= Does this support multiple instances? =
|
89 |
-
|
90 |
-
Yes.
|
91 |
|
92 |
= Does the menu change for each page you are on? =
|
93 |
|
@@ -100,6 +99,11 @@ You can add classes to your theme's style.css file to style it accordingly.
|
|
100 |
You may want to use something like margins to set the levels apart.
|
101 |
|
102 |
|
|
|
|
|
|
|
|
|
|
|
103 |
== Changelog ==
|
104 |
= 4.0.0 =
|
105 |
* Added support for an unlimited number of page levels
|
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.3
|
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 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.
|
38 |
<li>Levels of Categories to display</li>
|
39 |
</ol>
|
40 |
|
41 |
+
Templates may be overridden for customization of outputs and/or css.
|
42 |
+
|
43 |
+
Many built in filters for altering the way the widgets function.
|
44 |
|
45 |
|
46 |
|
87 |
You must have the option checked to use the built in CSS (in the widget) to be able to edit the css file in this way.
|
88 |
The Others will work always.
|
89 |
|
|
|
|
|
|
|
90 |
|
91 |
= Does the menu change for each page you are on? =
|
92 |
|
99 |
You may want to use something like margins to set the levels apart.
|
100 |
|
101 |
|
102 |
+
= What if I want functionality which is not built in? =
|
103 |
+
|
104 |
+
I do offer preminum services for buiding custom add-ons for additional functionality. Otherwise you are welcome to alter the code in any way or build your own add-ons. keep in mind, if you edit the code directly, it will break on update. The best way to customize is using the built in filters or template overides. If you have a cool add-on you have developed, let me know, I may want to publish your work.
|
105 |
+
|
106 |
+
|
107 |
== Changelog ==
|
108 |
= 4.0.0 =
|
109 |
* Added support for an unlimited number of page levels
|
sidebar-menu.css
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.advanced-sidebar-menu ul li a{
|
2 |
+
font-weight: bold;
|
3 |
+
font-size: 130%;
|
4 |
+
text-decoration: none;
|
5 |
+
}
|
6 |
+
|
7 |
+
.advanced-sidebar-menu ul li a:hover{
|
8 |
+
text-decoration: underline;
|
9 |
+
}
|
10 |
+
|
11 |
+
.advanced-sidebar-menu ul ul li a{
|
12 |
+
font-weight: normal;
|
13 |
+
font-size: 100%;
|
14 |
+
}
|
15 |
+
|
16 |
+
.advanced-sidebar-menu ul{
|
17 |
+
margin: 0 0 0 18px;
|
18 |
+
list-style: none;
|
19 |
+
list-style-type: none;
|
20 |
+
}
|
21 |
+
|
22 |
+
.advanced-sidebar-menu ul li{
|
23 |
+
list-style:none;
|
24 |
+
list-style-type: none;
|
25 |
+
margin: 0;
|
26 |
+
|
27 |
+
}
|
28 |
+
|
29 |
+
.advanced-sidebar-menu li.current_page_item{
|
30 |
+
list-style-type: disc;
|
31 |
+
}
|
32 |
+
|
33 |
+
.advanced-sidebar-menu li.current_page_item a{
|
34 |
+
font-weight: bold;
|
35 |
+
}
|
views/category_list.php
CHANGED
@@ -12,15 +12,18 @@
|
|
12 |
*/
|
13 |
|
14 |
|
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">';
|
@@ -45,7 +48,7 @@ if( $asm->include_parent() ){
|
|
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 |
-
|
49 |
$content .= '</ul>';
|
50 |
|
51 |
}
|
12 |
*/
|
13 |
|
14 |
|
|
|
|
|
15 |
|
16 |
|
17 |
+
$content = '';
|
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=' . trim($top_cat)) );
|
23 |
+
|
24 |
}
|
25 |
+
|
26 |
+
|
27 |
//If there are children to display
|
28 |
if( !empty($all_categories) ){
|
29 |
$content .= '<ul class="child-sidebar-menu">';
|
48 |
if( $asm->second_level_cat( $child_cat ) ){
|
49 |
#-- Create a new menu with all the children under it
|
50 |
$content .= '<ul class="grandchild-sidebar-menu">';
|
51 |
+
$content .= wp_list_categories("echo=0&title_li=&exclude=".$instance['exclude']."&depth=3&child_of=" .$child_cat->cat_ID );
|
52 |
$content .= '</ul>';
|
53 |
|
54 |
}
|
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
|
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
|
@@ -41,12 +41,9 @@ if( $child_pages ){
|
|
41 |
} else {
|
42 |
continue;
|
43 |
}
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
} else{
|
48 |
-
$content .= $asm->grandChildLegacyMode($pID);
|
49 |
-
}
|
50 |
|
51 |
$content .= '</li>';
|
52 |
}
|
2 |
/**
|
3 |
* The Ouput of the Advanced Sidebar Page Widget
|
4 |
* @author Mat Lipe
|
5 |
+
* @since 5.19.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
|
41 |
} else {
|
42 |
continue;
|
43 |
}
|
44 |
+
|
45 |
+
$content .= $asm->displayGrandChildMenu($pID);
|
46 |
+
|
|
|
|
|
|
|
47 |
|
48 |
$content .= '</li>';
|
49 |
}
|
widgets/category.widget.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Creates a Widget of parent Child Categories
|
6 |
*
|
7 |
* @author mat lipe
|
8 |
-
* @since
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*
|
11 |
*/
|
@@ -27,59 +27,59 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
27 |
|
28 |
|
29 |
#-----------------------------------------------------------------------------------------------------------------------------------
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
<input id="<?php echo $this->get_field_name('title'); ?>"
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
<p> Include Parent Category <input id="<?php echo $this->get_field_name('include_parent'); ?>"
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
if( $instance['single'] == checked ){
|
59 |
-
|
60 |
} else {
|
61 |
-
|
62 |
-
} ?>">
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
</span>
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
|
84 |
|
85 |
<p> Legacy Mode: (use pre 4.0 structure and css) <input id="<?php echo $this->get_field_name('legacy_mode'); ?>"
|
@@ -87,54 +87,48 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
87 |
<?php echo $instance['legacy_mode']; ?>/>
|
88 |
</p>
|
89 |
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
<p> Always Display Child Categories <input id="<?php echo $this->get_field_name('display_all'); ?>"
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
|
98 |
<span id="levels-<?php echo $this->get_field_name('levels'); ?>" style="<?php
|
99 |
if( $instance['display_all'] == checked ){
|
100 |
-
|
101 |
} else {
|
102 |
-
|
103 |
} ?>">
|
104 |
<p> Levels to Display <select id="<?php echo $this->get_field_name('levels'); ?>"
|
105 |
name="<?php echo $this->get_field_name('levels'); ?>">
|
106 |
<?php
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
|
116 |
|
117 |
do_action('advanced_sidebar_menu_category_widget_form', $instance );
|
118 |
|
119 |
-
|
120 |
|
121 |
-
#------------------------------------------------------------------------------------------------------------------------------
|
122 |
-
// this allows more than one instance
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
return $instance;
|
137 |
-
}
|
138 |
|
139 |
|
140 |
|
@@ -144,128 +138,123 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
144 |
/**
|
145 |
* Outputs the categories widget to the page
|
146 |
*
|
147 |
-
* @since
|
148 |
* @uses loads the views/category_list.php
|
149 |
*
|
150 |
* @filters apply_filters('advanced_sidebar_menu_category_widget_output', $content, $args, $instance );
|
151 |
*
|
152 |
*/
|
153 |
-
|
154 |
-
|
|
|
|
|
155 |
$asm->instance = $instance;
|
156 |
$asm->args = $args;
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
$exclude = explode(',', $instance['exclude']);
|
159 |
$asm->exclude = $exclude;
|
160 |
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
}
|
176 |
-
|
177 |
-
//IF on a category page get the id of the category
|
178 |
-
} elseif( is_category() ){
|
179 |
-
$cat_ids[] = get_query_var('cat');
|
180 |
-
}
|
181 |
|
182 |
//Go through each category there will be only one if this is a category page mulitple possible if this is single
|
183 |
foreach( $cat_ids as $cat_id ){
|
184 |
-
$cat_ancestors = array ();
|
185 |
-
$cat_ancestors[] = $cat_id ;
|
186 |
-
|
187 |
-
do {
|
188 |
-
$cat_id = get_category($cat_id );
|
189 |
-
$cat_id = $cat_id->parent;
|
190 |
-
$cat_ancestors[] = $cat_id ; }
|
191 |
-
while ($cat_id );
|
192 |
-
|
193 |
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
|
|
197 |
|
198 |
-
|
199 |
-
$top_cat = $cat_ancestors[1];
|
200 |
-
$asm->top_id = $top_cat;
|
201 |
-
|
202 |
-
|
203 |
-
//Keeps track or already used top levels so this won't double up
|
204 |
-
if( in_array( $top_cat, $already_top ) ){
|
205 |
-
continue;
|
206 |
-
}
|
207 |
-
$already_top[] = $top_cat;
|
208 |
-
|
209 |
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
//for depreciation
|
214 |
-
$all = $all_categories;
|
215 |
-
|
216 |
-
//If there are any child categories or the include childless parent is checked
|
217 |
-
if( !empty($all_categories ) || ($instance['include_childless_parent'] == 'checked' && !in_array($top_cat, $exclude)) ){
|
218 |
-
|
219 |
-
|
220 |
-
//Creates a new widget for each category the single page has if the options are selected to do so
|
221 |
-
if( !$asm_once || ($instance['new_widget'] == 'widget') ){
|
222 |
-
|
223 |
-
//Start the menu
|
224 |
-
echo $before_widget;
|
225 |
-
$count++; // To change the id of the widget if there are multiple
|
226 |
-
$asm_once = true; //There has been a div
|
227 |
-
$close = true; //The div should be closed at the end
|
228 |
-
if($instance['new_widget'] == 'list'){ $close = false;} //If this is a list leave it open for possible late ones
|
229 |
|
230 |
-
} else {
|
231 |
-
$close = false;
|
232 |
-
}
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
$legacy = isset( $instance['legacy_mode'] );
|
237 |
|
238 |
-
|
239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
include( $asm->file_hyercy('sidebar-menu.css', $legacy ) );
|
241 |
-
|
242 |
-
|
|
|
|
|
|
|
|
|
243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
|
|
|
|
|
|
|
|
|
|
245 |
|
246 |
-
|
247 |
-
|
248 |
|
249 |
-
|
|
|
250 |
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
|
|
255 |
|
256 |
-
} //End if any children or include childless parent
|
257 |
} //End of each cat loop
|
258 |
|
259 |
|
260 |
//IF we were waiting for all the individual lists to complete
|
261 |
if( !$close && $asm_once ){
|
262 |
-
|
263 |
-
|
264 |
-
|
|
|
265 |
}
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
} #== /Clas
|
5 |
* Creates a Widget of parent Child Categories
|
6 |
*
|
7 |
* @author mat lipe
|
8 |
+
* @since 5.19.13
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*
|
11 |
*/
|
27 |
|
28 |
|
29 |
#-----------------------------------------------------------------------------------------------------------------------------------
|
30 |
+
// this creates the widget form for the dashboard
|
31 |
+
function form( $instance ) {
|
32 |
+
// require( ADVANCED_SIDEBAR_DIR . 'advanced-sidebar-menu.js' );
|
33 |
+
?>
|
34 |
+
<p> Title <br>
|
35 |
<input id="<?php echo $this->get_field_name('title'); ?>"
|
36 |
+
name="<?php echo $this->get_field_name('title'); ?>" size="50" type="text" value="<?php echo $instance['title']; ?>"/></p>
|
37 |
+
|
38 |
+
|
39 |
<p> Include Parent Category <input id="<?php echo $this->get_field_name('include_parent'); ?>"
|
40 |
+
name="<?php echo $this->get_field_name('include_parent'); ?>" type="checkbox" value="checked"
|
41 |
+
<?php echo $instance['include_parent']; ?>/></p>
|
42 |
+
|
43 |
+
|
44 |
+
<p> Include Parent Even With No Children <input id="<?php echo $this->get_field_name('include_childless_parent'); ?>"
|
45 |
+
name="<?php echo $this->get_field_name('include_childless_parent'); ?>" type="checkbox" value="checked"
|
46 |
+
<?php echo $instance['include_childless_parent']; ?>/></p>
|
47 |
+
|
48 |
+
<p> Use this plugins styling <input id="<?php echo $this->get_field_name('css'); ?>"
|
49 |
+
name="<?php echo $this->get_field_name('css'); ?>" type="checkbox" value="checked"
|
50 |
+
<?php echo $instance['css']; ?>/></p>
|
51 |
+
|
52 |
+
<p> Display Categories on Single Posts <input id="<?php echo $this->get_field_name('single'); ?>"
|
53 |
+
name="<?php echo $this->get_field_name('single'); ?>" type="checkbox" value="checked"
|
54 |
+
onclick="javascript:asm_reveal_element( 'new-widget-<?php echo $this->get_field_name('new_widget'); ?>' )"
|
55 |
+
<?php echo $instance['single']; ?>/></p>
|
56 |
+
|
57 |
+
<span id="new-widget-<?php echo $this->get_field_name('new_widget'); ?>" style="<?php
|
58 |
if( $instance['single'] == checked ){
|
59 |
+
echo 'display:block';
|
60 |
} else {
|
61 |
+
echo 'display:none';
|
62 |
+
} ?>">
|
63 |
+
<p>Display Each Single Post's Category
|
64 |
+
<select id="<?php echo $this->get_field_name('new_widget'); ?>"
|
65 |
+
name="<?php echo $this->get_field_name('new_widget'); ?>">
|
66 |
+
<?php
|
67 |
+
if( $instance['new_widget'] == 'widget' ){
|
68 |
+
echo '<option value="widget" selected> In a new widget </option>';
|
69 |
+
echo '<option value="list"> In another list in the same widget </option>';
|
70 |
+
} else {
|
71 |
+
echo '<option value="widget"> In a new widget </option>';
|
72 |
+
echo '<option value="list" selected> In another list in the same widget </option>';
|
73 |
+
}
|
74 |
+
|
75 |
+
?></select>
|
76 |
+
</p>
|
77 |
</span>
|
78 |
|
79 |
+
|
80 |
+
|
81 |
+
<p> Categories to Exclude, Comma Separated:<input id="<?php echo $this->get_field_name('exclude'); ?>"
|
82 |
+
name="<?php echo $this->get_field_name('exclude'); ?>" type="text" value="<?php echo $instance['exclude']; ?>"/></p>
|
83 |
|
84 |
|
85 |
<p> Legacy Mode: (use pre 4.0 structure and css) <input id="<?php echo $this->get_field_name('legacy_mode'); ?>"
|
87 |
<?php echo $instance['legacy_mode']; ?>/>
|
88 |
</p>
|
89 |
|
90 |
+
|
|
|
|
|
91 |
<p> Always Display Child Categories <input id="<?php echo $this->get_field_name('display_all'); ?>"
|
92 |
+
name="<?php echo $this->get_field_name('display_all'); ?>" type="checkbox" value="checked"
|
93 |
+
onclick="javascript:asm_reveal_element( 'levels-<?php echo $this->get_field_name('levels'); ?>' )"
|
94 |
+
<?php echo $instance['display_all']; ?>/></p>
|
95 |
|
96 |
<span id="levels-<?php echo $this->get_field_name('levels'); ?>" style="<?php
|
97 |
if( $instance['display_all'] == checked ){
|
98 |
+
echo 'display:block';
|
99 |
} else {
|
100 |
+
echo 'display:none';
|
101 |
} ?>">
|
102 |
<p> Levels to Display <select id="<?php echo $this->get_field_name('levels'); ?>"
|
103 |
name="<?php echo $this->get_field_name('levels'); ?>">
|
104 |
<?php
|
105 |
+
for( $i= 1; $i<6; $i++ ){
|
106 |
+
if( $i == $instance['levels'] ){
|
107 |
+
echo '<option value="'.$i.'" selected>'.$i.'</option>';
|
108 |
+
} else {
|
109 |
+
echo '<option value="'.$i.'">'.$i.'</option>';
|
110 |
+
}
|
111 |
+
}
|
112 |
+
echo '</select></p></span>';
|
113 |
|
114 |
|
115 |
do_action('advanced_sidebar_menu_category_widget_form', $instance );
|
116 |
|
117 |
+
}
|
118 |
|
|
|
|
|
119 |
|
120 |
+
/**
|
121 |
+
* Updates the widget data
|
122 |
+
*
|
123 |
+
* @filter - $newInstance = apply_filters('advanced_sidebar_menu_category_widget_update', $newInstance, $oldInstance );
|
124 |
+
* @since 5.19.13
|
125 |
+
*/
|
126 |
+
function update( $newInstance, $oldInstance ) {
|
127 |
+
$newInstance['exclude'] = strip_tags($new_instance['exclude']);
|
128 |
+
$newInstance = apply_filters('advanced_sidebar_menu_category_widget_update', $newInstance, $oldInstance );
|
129 |
+
|
130 |
+
return $newInstance;
|
131 |
+
}
|
|
|
|
|
132 |
|
133 |
|
134 |
|
138 |
/**
|
139 |
* Outputs the categories widget to the page
|
140 |
*
|
141 |
+
* @since 5.19.13
|
142 |
* @uses loads the views/category_list.php
|
143 |
*
|
144 |
* @filters apply_filters('advanced_sidebar_menu_category_widget_output', $content, $args, $instance );
|
145 |
*
|
146 |
*/
|
147 |
+
function widget($args, $instance) {
|
148 |
+
|
149 |
+
if( is_single() && !isset( $instance['single'] ) ) return;
|
150 |
+
$asm = new advancedSidebarMenu;
|
151 |
$asm->instance = $instance;
|
152 |
$asm->args = $args;
|
153 |
|
154 |
+
$legacy = $asm->checked('legacy_mode');
|
155 |
+
|
156 |
+
$cat_ids = $already_top = array();
|
157 |
+
$asm_once = $asm_cat_widget_count = false; //keeps track of how many widgets this created
|
158 |
+
$count = null;
|
159 |
+
|
160 |
$exclude = explode(',', $instance['exclude']);
|
161 |
$asm->exclude = $exclude;
|
162 |
|
163 |
+
extract( $args);
|
164 |
+
|
165 |
+
|
166 |
+
//If on a single page create an array of each category and create a list for each
|
167 |
+
if( is_single() && $asm->checked('single' ) ){
|
168 |
+
$category_array = get_the_category();
|
169 |
+
foreach( get_the_category() as $id => $cat ){
|
170 |
+
$cat_ids[] = $cat->term_id;
|
171 |
+
}
|
172 |
+
|
173 |
+
//IF on a category page get the id of the category
|
174 |
+
} elseif( is_category() ){
|
175 |
+
$cat_ids[] = get_query_var('cat');
|
176 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
|
178 |
//Go through each category there will be only one if this is a category page mulitple possible if this is single
|
179 |
foreach( $cat_ids as $cat_id ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
|
181 |
+
//Get the top category id
|
182 |
+
$asm->top_id = $asm->getTopCat($cat_id);
|
183 |
+
|
184 |
+
//Keeps track or already used top levels so this won't double up
|
185 |
+
if( in_array( $asm->top_id, $already_top ) ) continue;
|
186 |
|
187 |
+
$already_top[] = $asm->top_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
|
189 |
+
//Check for children
|
190 |
+
$all_categories = $all = array_filter(get_categories( array( 'child_of' => $asm->top_id )) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
|
193 |
+
//If there are no children and not displaying childless parent - bail
|
194 |
+
if( empty($all_categories ) && !( $asm->checked('include_childless_parent') ) ) continue;
|
195 |
+
//If there are no children and the parent is excluded bail
|
196 |
+
if( empty($all_categories ) && in_array($asm->top_id, $exclude) ) continue;
|
197 |
+
|
198 |
+
|
199 |
+
//Creates a new widget for each category the single page has if the options are selected to do so
|
200 |
+
//Also starts the first widget
|
201 |
+
if( !$asm_once || ($instance['new_widget'] == 'widget') ){
|
202 |
+
|
203 |
+
//Start the menu
|
204 |
+
echo $before_widget;
|
205 |
+
if( !$asm_once ) {
|
206 |
+
$asm->title();
|
207 |
+
if( $asm->checked('css') ){
|
208 |
+
echo '<style type="text/css">';
|
209 |
include( $asm->file_hyercy('sidebar-menu.css', $legacy ) );
|
210 |
+
echo '</style>';
|
211 |
+
}
|
212 |
+
|
213 |
+
$count++; // To change the id of the widget if there are multiple
|
214 |
+
$asm_once = true; //There has been a div
|
215 |
+
$close = true; //The div should be closed at the end
|
216 |
|
217 |
+
if($instance['new_widget'] == 'list'){
|
218 |
+
$close = false; //If this is a list leave it open for now
|
219 |
+
}
|
220 |
+
|
221 |
+
} else {
|
222 |
+
$close = false;
|
223 |
+
}
|
224 |
+
|
225 |
|
226 |
+
//for deprecation
|
227 |
+
$top_cat = $cat_id;
|
228 |
+
$cat_ancestors = $asm->ancestors;
|
229 |
+
|
230 |
+
}
|
231 |
|
232 |
+
//Bring in the view
|
233 |
+
require( $asm->file_hyercy( 'category_list.php', $legacy ) );
|
234 |
|
235 |
+
|
236 |
+
echo apply_filters('advanced_sidebar_menu_category_widget_output', $content, $args, $instance );
|
237 |
|
238 |
+
if( $close ){
|
239 |
+
//End the Widget Area
|
240 |
+
echo $after_widget;
|
241 |
+
echo '<!-- First $after_widget -->';
|
242 |
+
}
|
243 |
+
|
244 |
|
|
|
245 |
} //End of each cat loop
|
246 |
|
247 |
|
248 |
//IF we were waiting for all the individual lists to complete
|
249 |
if( !$close && $asm_once ){
|
250 |
+
//End the Widget Area
|
251 |
+
echo $after_widget;
|
252 |
+
echo '<!-- Second $after_widget -->';
|
253 |
+
|
254 |
}
|
255 |
+
|
256 |
+
|
257 |
+
|
258 |
+
} #== /widget()
|
259 |
+
|
260 |
} #== /Clas
|
widgets/page.widget.php
CHANGED
@@ -32,72 +32,79 @@ 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.23.13
|
36 |
*/
|
37 |
-
|
38 |
?>
|
39 |
<p> Title <br>
|
40 |
<input id="<?php echo $this->get_field_id('title'); ?>"
|
41 |
-
|
42 |
|
43 |
<p> Include Parent Page: <input id="<?php echo $this->get_field_id('include_parent'); ?>"
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
<p> Legacy Mode: (use pre 4.0 structure and css) <input id="<?php echo $this->get_field_name('legacy_mode'); ?>"
|
59 |
name="<?php echo $this->get_field_name('legacy_mode'); ?>" type="checkbox" value="checked"
|
60 |
<?php echo $instance['legacy_mode']; ?>/>
|
61 |
</p>
|
62 |
-
|
63 |
<p> Always Display Child Pages: <input id="<?php echo $this->get_field_id('display_all'); ?>"
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
|
68 |
<span id="levels-<?php echo $this->get_field_id('levels'); ?>" style="<?php
|
69 |
if( $instance['display_all'] == 'checked' ){
|
70 |
-
|
71 |
} else {
|
72 |
-
|
73 |
} ?>">
|
74 |
<p> Levels to Display: <select id="<?php echo $this->get_field_id('levels'); ?>"
|
75 |
name="<?php echo $this->get_field_name('levels'); ?>">
|
76 |
<?php
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
|
86 |
|
87 |
do_action('advanced_sidebar_menu_page_widget_form', $instance, $this->get_field_name('parent_only'), $this->get_field_id('parent_only'));
|
88 |
|
89 |
|
90 |
-
|
91 |
|
92 |
|
93 |
/**
|
94 |
* Handles the saving of the widget
|
95 |
*
|
96 |
-
* @
|
|
|
|
|
97 |
*/
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
|
|
|
|
101 |
}
|
102 |
|
103 |
|
@@ -117,10 +124,10 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
117 |
* apply_filters('advanced_sidebar_menu_post_type', 'page', $args, $instance );
|
118 |
*
|
119 |
*
|
120 |
-
* @since
|
121 |
*/
|
122 |
-
|
123 |
-
|
124 |
|
125 |
//There will be no pages to generate on an archive page
|
126 |
if( is_archive() ) return;
|
@@ -129,73 +136,77 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
129 |
|
130 |
$asm->instance = $instance;
|
131 |
$asm->args = $args;
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
|
|
|
|
|
|
139 |
add_filter('page_css_class', array( $asm, 'custom_post_type_css'), 2, 4 );
|
140 |
|
141 |
}
|
142 |
|
143 |
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
$asm->exclude = $exclude;
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
$asm->top_id = $top_parent;
|
162 |
|
163 |
|
164 |
//Filter for specifiying the order by
|
165 |
$order_by = apply_filters('advanced_sidebar_menu_order_by', 'menu_order', $post, $args, $instance );
|
166 |
-
|
|
|
167 |
|
|
|
|
|
|
|
|
|
168 |
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
$child_pages = $wpdb->get_results( "SELECT ID FROM ". $wpdb->posts ." WHERE post_parent = $top_parent AND post_status='publish' AND post_type='$post_type' Order by $order_by" );
|
173 |
-
|
174 |
-
//for depreciation
|
175 |
-
$p = $top_parent;
|
176 |
-
$result = $child_pages = apply_filters( 'advanced_sidebar_menu_child_pages', $child_pages, $post, $args, $instance );
|
177 |
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
$legacy = isset( $instance['legacy_mode'] );
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
|
|
|
|
194 |
echo apply_filters('advanced_sidebar_menu_page_widget_output',$content, $args, $instance );
|
195 |
-
|
196 |
|
197 |
-
|
198 |
|
199 |
-
|
200 |
-
|
201 |
} #== /Clas
|
32 |
* Not of ton of options here but who need them
|
33 |
* Most of the magic happens automatically
|
34 |
*
|
35 |
+
* @filters do_action('advanced_sidebar_menu_page_widget_form', $instance, $this->get_field_name('parent_only'), $this->get_field_id('parent_only'));
|
36 |
+
*
|
37 |
* @since 4.23.13
|
38 |
*/
|
39 |
+
function form( $instance ) {
|
40 |
?>
|
41 |
<p> Title <br>
|
42 |
<input id="<?php echo $this->get_field_id('title'); ?>"
|
43 |
+
name="<?php echo $this->get_field_name('title'); ?>" size="50" type="text" value="<?php echo $instance['title']; ?>"/></p>
|
44 |
|
45 |
<p> Include Parent Page: <input id="<?php echo $this->get_field_id('include_parent'); ?>"
|
46 |
+
name="<?php echo $this->get_field_name('include_parent'); ?>" type="checkbox" value="checked"
|
47 |
+
<?php echo $instance['include_parent']; ?>/></p>
|
48 |
+
|
49 |
+
|
50 |
+
<p> Include Parent Even With No Children: <input id="<?php echo $this->get_field_id('include_childless_parent'); ?>"
|
51 |
+
name="<?php echo $this->get_field_name('include_childless_parent'); ?>" type="checkbox" value="checked"
|
52 |
+
<?php echo $instance['include_childless_parent']; ?>/></p>
|
53 |
+
|
54 |
+
<p> Use this Plugin's Styling: <input id="<?php echo $this->get_field_id('css'); ?>"
|
55 |
+
name="<?php echo $this->get_field_name('css'); ?>" type="checkbox" value="checked"
|
56 |
+
<?php echo $instance['css']; ?>/></p>
|
57 |
+
|
58 |
+
<p> Pages to Exclude, Comma Separated: <input id="<?php echo $this->get_field_id('exclude'); ?>"
|
59 |
+
name="<?php echo $this->get_field_name('exclude'); ?>" type="text" value="<?php echo $instance['exclude']; ?>"/></p>
|
60 |
<p> Legacy Mode: (use pre 4.0 structure and css) <input id="<?php echo $this->get_field_name('legacy_mode'); ?>"
|
61 |
name="<?php echo $this->get_field_name('legacy_mode'); ?>" type="checkbox" value="checked"
|
62 |
<?php echo $instance['legacy_mode']; ?>/>
|
63 |
</p>
|
64 |
+
|
65 |
<p> Always Display Child Pages: <input id="<?php echo $this->get_field_id('display_all'); ?>"
|
66 |
+
name="<?php echo $this->get_field_name('display_all'); ?>" type="checkbox" value="checked"
|
67 |
+
onclick="javascript:asm_reveal_element( 'levels-<?php echo $this->get_field_id('levels'); ?>' )"
|
68 |
+
<?php echo $instance['display_all']; ?>/></p>
|
69 |
|
70 |
<span id="levels-<?php echo $this->get_field_id('levels'); ?>" style="<?php
|
71 |
if( $instance['display_all'] == 'checked' ){
|
72 |
+
echo 'display:block';
|
73 |
} else {
|
74 |
+
echo 'display:none';
|
75 |
} ?>">
|
76 |
<p> Levels to Display: <select id="<?php echo $this->get_field_id('levels'); ?>"
|
77 |
name="<?php echo $this->get_field_name('levels'); ?>">
|
78 |
<?php
|
79 |
+
for( $i= 1; $i<6; $i++ ){
|
80 |
+
if( $i == $instance['levels'] ){
|
81 |
+
echo '<option value="'.$i.'" selected>'.$i.'</option>';
|
82 |
+
} else {
|
83 |
+
echo '<option value="'.$i.'">'.$i.'</option>';
|
84 |
+
}
|
85 |
+
}
|
86 |
+
echo '</select></p></span>';
|
87 |
|
88 |
|
89 |
do_action('advanced_sidebar_menu_page_widget_form', $instance, $this->get_field_name('parent_only'), $this->get_field_id('parent_only'));
|
90 |
|
91 |
|
92 |
+
}
|
93 |
|
94 |
|
95 |
/**
|
96 |
* Handles the saving of the widget
|
97 |
*
|
98 |
+
* @filters apply_filters('advanced_sidebar_menu_page_widget_update', $newInstance, $oldInstance );
|
99 |
+
*
|
100 |
+
* @since 4.26.13
|
101 |
*/
|
102 |
+
function update( $newInstance, $oldInstance ) {
|
103 |
+
$newInstance['exclude'] = strip_tags($newInstance['exclude']);
|
104 |
+
|
105 |
+
$newInstance = apply_filters('advanced_sidebar_menu_page_widget_update', $newInstance, $oldInstance );
|
106 |
+
|
107 |
+
return $newInstance;
|
108 |
}
|
109 |
|
110 |
|
124 |
* apply_filters('advanced_sidebar_menu_post_type', 'page', $args, $instance );
|
125 |
*
|
126 |
*
|
127 |
+
* @since 5.19.13
|
128 |
*/
|
129 |
+
function widget($args, $instance) {
|
130 |
+
global $wpdb, $post, $table_prefix;
|
131 |
|
132 |
//There will be no pages to generate on an archive page
|
133 |
if( is_archive() ) return;
|
136 |
|
137 |
$asm->instance = $instance;
|
138 |
$asm->args = $args;
|
139 |
+
extract($args);
|
140 |
+
|
141 |
+
//Filter this one with a 'single' for a custom post type will default to working for pages only
|
142 |
+
$post_type = apply_filters('advanced_sidebar_menu_post_type', 'page', $args, $instance );
|
143 |
+
|
144 |
+
if( !(is_single() || is_page() ) || (get_post_type() != $post_type) ) return;
|
145 |
+
|
146 |
+
|
147 |
+
$asm->post_type = $post_type;
|
148 |
+
|
149 |
+
if( $post_type != 'page' ){
|
150 |
add_filter('page_css_class', array( $asm, 'custom_post_type_css'), 2, 4 );
|
151 |
|
152 |
}
|
153 |
|
154 |
|
155 |
+
|
156 |
+
#-- Create a usable array of the excluded pages
|
157 |
+
$exclude = explode(',', $instance['exclude']);
|
158 |
$asm->exclude = $exclude;
|
159 |
|
160 |
+
|
161 |
+
#-- if the post has parents
|
162 |
+
if($post->ancestors){
|
163 |
+
$top_parent = end( $post->ancestors );
|
164 |
+
} else {
|
165 |
+
#--------- If this is the parent ------------------------------------------------
|
166 |
+
$top_parent = $post->ID;
|
167 |
+
}
|
168 |
+
|
169 |
+
|
170 |
+
//Filter for specifying the top parent
|
171 |
+
$top_parent = apply_filters('advanced_sidebar_menu_top_parent', $top_parent, $post, $args, $instance );
|
172 |
$asm->top_id = $top_parent;
|
173 |
|
174 |
|
175 |
//Filter for specifiying the order by
|
176 |
$order_by = apply_filters('advanced_sidebar_menu_order_by', 'menu_order', $post, $args, $instance );
|
177 |
+
$asm->order_by = $order_by;
|
178 |
+
|
179 |
|
180 |
+
/**
|
181 |
+
* Must be done this way to prevent doubling up of pages
|
182 |
+
*/
|
183 |
+
$child_pages = $wpdb->get_results( "SELECT ID FROM ". $wpdb->posts ." WHERE post_parent = $top_parent AND post_status='publish' AND post_type='$post_type' Order by $order_by" );
|
184 |
|
185 |
+
//for depreciation
|
186 |
+
$p = $top_parent;
|
187 |
+
$result = $child_pages = apply_filters( 'advanced_sidebar_menu_child_pages', $child_pages, $post, $args, $instance );
|
|
|
|
|
|
|
|
|
|
|
188 |
|
189 |
+
#---- if there are no children do not display the parent unless it is check to do so
|
190 |
+
if( ($child_pages) || $asm->checked('include_childless_parent') && (!in_array($top_parent, $exclude) ) ){
|
|
|
|
|
191 |
|
192 |
+
$legacy = $asm->checked('legacy_mode' );
|
193 |
+
|
194 |
+
if( $asm->checked('css') ){
|
195 |
+
echo '<style type="text/css">';
|
196 |
+
include( $asm->file_hyercy('sidebar-menu.css', $legacy ) );
|
197 |
+
echo '</style>';
|
198 |
+
}
|
199 |
+
|
200 |
+
|
201 |
+
//Start the menu
|
202 |
+
echo $before_widget;
|
203 |
+
#-- Bring in the
|
204 |
+
require( $asm->file_hyercy( 'page_list.php', $legacy ) );
|
205 |
echo apply_filters('advanced_sidebar_menu_page_widget_output',$content, $args, $instance );
|
206 |
+
echo $after_widget;
|
207 |
|
208 |
+
}
|
209 |
|
210 |
+
} #== /widget()
|
211 |
+
|
212 |
} #== /Clas
|