Advanced Sidebar Menu - Version 4.3.2

Version Description

Download this release

Release Info

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

Code changes from version 4.3.1 to 4.3.2

advanced-sidebar-menu.php CHANGED
@@ -4,9 +4,9 @@ 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.3.1
8
Author URI: http://lipeimagination.info
9
- Since: 6.7.13
10
*/
11
12
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.3.2
8
Author URI: http://lipeimagination.info
9
+ Since: 6.13.13
10
*/
11
12
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 6.6.13
8
*
9
* @package Advanced Sidebar Menu
10
*/
@@ -203,37 +203,45 @@ class advancedSidebarMenu{
203
* IF this is a top level category
204
* @param obj $cat the cat object
205
*
206
- * @since 6.7.13
207
*/
208
function first_level_category( $cat ){
209
210
if( !in_array($cat->term_id, $this->exclude) && $cat->parent == $this->top_id){
211
- return true;
212
} else {
213
-
214
- return false;
215
}
216
}
217
218
/**
219
* If the cat is a second level cat
220
* @param obj $cat the cat
221
- * @since 6.7.13
222
*/
223
- function second_level_cat( $child_cat ){
224
//if this is the currrent cat or a parent of the current cat
225
- if( $child_cat->term_id == $this->current_term || in_array( $child_cat->term_id, $this->ancestors )){
226
$all_children = array();
227
- $all_children = get_terms( $this->taxonomy, array( 'child_of' => $child_cat->term_id ) );
228
if( !empty( $all_children ) ){
229
- return true;
230
} else {
231
- return false;
232
}
233
234
} else {
235
- return false;
236
}
237
}
238
239
/**
@@ -268,15 +276,18 @@ class advancedSidebarMenu{
268
*
269
* Determines if this is an ancestor or the current post
270
* @param obj $pID the post object
271
- * @since 7/19/12
272
*/
273
function page_ancestor( $pID ){
274
global $post;
275
if($pID->ID == $post->ID or $pID->ID == $post->post_parent or @in_array($pID->ID, $post->ancestors) ){
276
- return true;
277
} else {
278
- return false;
279
}
280
}
281
282
4
/**
5
* These Functions are Specific to the Advanced Sidebar Menu
6
* @author Mat Lipe
7
+ * @since 6.13.13
8
*
9
* @package Advanced Sidebar Menu
10
*/
203
* IF this is a top level category
204
* @param obj $cat the cat object
205
*
206
+ * @since 6.13.13
207
*/
208
function first_level_category( $cat ){
209
210
if( !in_array($cat->term_id, $this->exclude) && $cat->parent == $this->top_id){
211
+ $return = true;
212
} else {
213
+ $return = false;
214
}
215
+
216
+ return apply_filters('advanced_sidebar_menu_first_level_category', $return, $cat, $this);
217
+
218
}
219
220
/**
221
* If the cat is a second level cat
222
* @param obj $cat the cat
223
+ * @since 6.13.13
224
*/
225
+ function second_level_cat( $cat ){
226
+
227
//if this is the currrent cat or a parent of the current cat
228
+ if( $cat->term_id == $this->current_term || in_array( $cat->term_id, $this->ancestors )){
229
+
230
$all_children = array();
231
+ $all_children = get_terms( $this->taxonomy, array( 'child_of' => $cat->term_id, 'fields' => 'ids' ) );
232
if( !empty( $all_children ) ){
233
+ $return = true;
234
} else {
235
+ $return = false;
236
}
237
238
} else {
239
+ $return = false;
240
}
241
+
242
+ return apply_filters('advanced_sidebar_menu_second_level_category', $return, $cat, $this);
243
+
244
+
245
}
246
247
/**
276
*
277
* Determines if this is an ancestor or the current post
278
* @param obj $pID the post object
279
+ * @since 6.13.13
280
*/
281
function page_ancestor( $pID ){
282
global $post;
283
+
284
if($pID->ID == $post->ID or $pID->ID == $post->post_parent or @in_array($pID->ID, $post->ancestors) ){
285
+ $return = true;
286
} else {
287
+ $return = false;
288
}
289
+
290
+ return apply_filters('advanced_sidebar_menu_page_ancestor', $return, $pID, $this);
291
}
292
293
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.3.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
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.3.2
8
9
Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
10
sidebar-menu.css DELETED
@@ -1,35 +0,0 @@
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
@@ -29,7 +29,7 @@ if( $asm->include_parent() ){
29
$content .= wp_list_categories('echo=0&orderby='.$asm->order_by.'&taxonomy='.$asm->taxonomy.'&title_li=&child_of=' . $asm->top_id .'&depth=' .$instance['levels'] );
30
31
} else {
32
-
33
#-- to Display the categories based a parent child relationship
34
foreach( $all_categories as $child_cat ){
35
29
$content .= wp_list_categories('echo=0&orderby='.$asm->order_by.'&taxonomy='.$asm->taxonomy.'&title_li=&child_of=' . $asm->top_id .'&depth=' .$instance['levels'] );
30
31
} else {
32
+
33
#-- to Display the categories based a parent child relationship
34
foreach( $all_categories as $child_cat ){
35
widgets/category.widget.php CHANGED
@@ -191,7 +191,7 @@ class advanced_sidebar_menu_category extends WP_Widget {
191
192
193
$cat_ids = apply_filters( 'advanced_sidebar_menu_category_ids', $cat_ids, $args, $instance );
194
-
195
if( empty( $cat_ids ) ) return;
196
197
//Go through each category there will be only one if this is a category page mulitple possible if this is single
@@ -204,13 +204,15 @@ class advanced_sidebar_menu_category extends WP_Widget {
204
if( in_array( $asm->top_id, $already_top ) ) continue;
205
206
$already_top[] = $asm->top_id;
207
208
//Check for children
209
$all_categories = $all = array_filter( get_terms( $asm->taxonomy, array(
210
- 'child_of' => $child_cat->cat_ID,
211
'orderby' => $asm->order_by )
212
)
213
);
214
//For Backwards Compatibility
215
foreach( $all_categories as $tc ){
216
$tc->cat_ID = $tc->term_id;
@@ -251,7 +253,6 @@ class advanced_sidebar_menu_category extends WP_Widget {
251
$top_cat = $asm->top_id;
252
$cat_ancestors = $asm->ancestors;
253
254
-
255
//Bring in the view
256
require( $asm->file_hyercy( 'category_list.php', $legacy ) );
257
191
192
193
$cat_ids = apply_filters( 'advanced_sidebar_menu_category_ids', $cat_ids, $args, $instance );
194
+
195
if( empty( $cat_ids ) ) return;
196
197
//Go through each category there will be only one if this is a category page mulitple possible if this is single
204
if( in_array( $asm->top_id, $already_top ) ) continue;
205
206
$already_top[] = $asm->top_id;
207
+
208
209
//Check for children
210
$all_categories = $all = array_filter( get_terms( $asm->taxonomy, array(
211
+ 'child_of' => $asm->top_id,
212
'orderby' => $asm->order_by )
213
)
214
);
215
+
216
//For Backwards Compatibility
217
foreach( $all_categories as $tc ){
218
$tc->cat_ID = $tc->term_id;
253
$top_cat = $asm->top_id;
254
$cat_ancestors = $asm->ancestors;
255
256
//Bring in the view
257
require( $asm->file_hyercy( 'category_list.php', $legacy ) );
258