Advanced Sidebar Menu - Version 4.7.6

Version Description

Download this release

Release Info

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

Code changes from version 4.7.5 to 4.7.6

Files changed (3) hide show
  1. advanced-sidebar-menu.php +2 -2
  2. readme.txt +1 -3
  3. widgets/page.widget.php +25 -15
advanced-sidebar-menu.php CHANGED
@@ -4,11 +4,11 @@ Plugin Name: Advanced Sidebar Menu
4
Plugin URI: http://matlipe.com/advanced-sidebar-menu/
5
Description: Creates dynamic menu based on child/parent relationship.
6
Author: Mat Lipe
7
- Version: 4.7.5
8
Author URI: http://matlipe.com
9
*/
10
11
- define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '4.7.5' );
12
13
14
#-- Define Constants
4
Plugin URI: http://matlipe.com/advanced-sidebar-menu/
5
Description: Creates dynamic menu based on child/parent relationship.
6
Author: Mat Lipe
7
+ Version: 4.7.6
8
Author URI: http://matlipe.com
9
*/
10
11
+ define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '4.7.6' );
12
13
14
#-- Define Constants
readme.txt CHANGED
@@ -5,14 +5,12 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypa
5
Tags: menus, sidebar menu, heirchy, category menu, pages menu
6
Requires at least: 3.8.0
7
Tested up to: 3.9.1
8
- Stable tag: 4.7.5
9
10
Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
11
12
== Description ==
13
14
- <h4>Now Supports Internationalization Text Domain 'advanced-sidebar-menu'</h4>
15
-
16
Creates a widget for both page and categories that will display the current page/category and an child pages or categories.
17
Keeps the menu clean and usable.
18
5
Tags: menus, sidebar menu, heirchy, category menu, pages menu
6
Requires at least: 3.8.0
7
Tested up to: 3.9.1
8
+ Stable tag: 4.7.6
9
10
Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
11
12
== Description ==
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.
16
widgets/page.widget.php CHANGED
@@ -1,11 +1,14 @@
1
<?php
2
/**
3
- * Creates a Widget of parent Child Pages
4
*
5
* @author mat lipe <mat@matlipe.com>
6
- * @since 12.12.13
7
* @package Advanced Sidebar Menu
8
- *
9
*/
10
class advanced_sidebar_menu_page extends WP_Widget {
11
@@ -30,12 +33,18 @@ class advanced_sidebar_menu_page extends WP_Widget {
30
*
31
*/
32
function __construct() {
33
- /* Widget settings. */
34
- $widget_ops = array( 'classname' => 'advanced-sidebar-menu', 'description' => __('Creates a menu of all the pages using the child/parent relationship', 'advanced-sidebar-menu') );
35
- $control_ops = array( 'width' => 290 );
36
37
/* Create the widget. */
38
$this->WP_Widget( 'advanced_sidebar_menu', __('Advanced Sidebar Pages Menu','advanced-sidebar-menu'), $widget_ops, $control_ops);
39
}
40
41
@@ -187,17 +196,19 @@ class advanced_sidebar_menu_page extends WP_Widget {
187
$asm->post_type = $post_type;
188
189
//Add a has_children class to appropriate pages
190
- add_filter('page_css_class', array( $asm, 'hasChildrenClass'), 2, 2 );
191
192
//Add the default classes to pages from a custom post type
193
if( $asm->post_type != 'page' ){
194
- add_filter('page_css_class', array( $asm, 'custom_post_type_css'), 2, 4 );
195
}
196
197
198
- $proper_single = !(is_single() || is_page() ) || (get_post_type() != $post_type);
199
//Filter the single post check if try to display the menu somewhere else like a category page
200
- if( apply_filters('advanced_sidebar_menu_proper_single', $proper_single, $args, $instance, $asm) ) return;
201
202
203
//Get the Top Parent Id
@@ -208,7 +219,7 @@ class advanced_sidebar_menu_page extends WP_Widget {
208
$top_parent = $post->ID;
209
}
210
//Filter for specifying the top parent
211
- $top_parent = apply_filters('advanced_sidebar_menu_top_parent', $top_parent, $post, $args, $instance, $asm );
212
$asm->top_id = $top_parent;
213
214
@@ -220,12 +231,11 @@ class advanced_sidebar_menu_page extends WP_Widget {
220
$order_by = apply_filters('advanced_sidebar_menu_order_by', $instance['order_by'], $post, $args, $instance, $asm );
221
$asm->order_by = $order_by;
222
223
-
224
/**
225
* Must be done this way to prevent doubling up of pages
226
*/
227
- $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" );
228
-
229
//for depreciation
230
$p = $top_parent;
231
$result = $child_pages = apply_filters( 'advanced_sidebar_menu_child_pages', $child_pages, $post, $args, $instance, $asm );
@@ -251,7 +261,7 @@ class advanced_sidebar_menu_page extends WP_Widget {
251
echo $after_widget;
252
253
}
254
-
255
} #== /widget()
256
257
} #== /Clas
1
<?php
2
/**
3
+ * Advanced Sidebar Menu Page
4
+ *
5
+ * Creates a Widget of parent Child Pages
6
*
7
* @author mat lipe <mat@matlipe.com>
8
+ *
9
* @package Advanced Sidebar Menu
10
+ * @class advanced_sidebar_menu_page
11
+ *
12
*/
13
class advanced_sidebar_menu_page extends WP_Widget {
14
33
*
34
*/
35
function __construct() {
36
+ /* Widget settings. */
37
+ $widget_ops = array(
38
+ 'classname' => 'advanced-sidebar-menu',
39
+ 'description' => __('Creates a menu of all the pages using the child/parent relationship', 'advanced-sidebar-menu')
40
+ );
41
+ $control_ops = array(
42
+ 'width' => 290
43
+ );
44
45
/* Create the widget. */
46
$this->WP_Widget( 'advanced_sidebar_menu', __('Advanced Sidebar Pages Menu','advanced-sidebar-menu'), $widget_ops, $control_ops);
47
+
48
}
49
50
196
$asm->post_type = $post_type;
197
198
//Add a has_children class to appropriate pages
199
+ add_filter( 'page_css_class', array( $asm, 'hasChildrenClass' ), 2, 2 );
200
201
//Add the default classes to pages from a custom post type
202
if( $asm->post_type != 'page' ){
203
+ add_filter( 'page_css_class', array( $asm, 'custom_post_type_css' ), 2, 4 );
204
}
205
206
207
+ $proper_single = !( is_page() || ( is_single() && $asm->post_type == get_post_type() ) );
208
//Filter the single post check if try to display the menu somewhere else like a category page
209
+ if( apply_filters( 'advanced_sidebar_menu_proper_single', $proper_single, $args, $instance, $asm ) ){
210
+ return;
211
+ }
212
213
214
//Get the Top Parent Id
219
$top_parent = $post->ID;
220
}
221
//Filter for specifying the top parent
222
+ $top_parent = apply_filters( 'advanced_sidebar_menu_top_parent', $top_parent, $post, $args, $instance, $asm );
223
$asm->top_id = $top_parent;
224
225
231
$order_by = apply_filters('advanced_sidebar_menu_order_by', $instance['order_by'], $post, $args, $instance, $asm );
232
$asm->order_by = $order_by;
233
234
/**
235
* Must be done this way to prevent doubling up of pages
236
*/
237
+ $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" );
238
+
239
//for depreciation
240
$p = $top_parent;
241
$result = $child_pages = apply_filters( 'advanced_sidebar_menu_child_pages', $child_pages, $post, $args, $instance, $asm );
261
echo $after_widget;
262
263
}
264
+
265
} #== /widget()
266
267
} #== /Clas