Advanced Sidebar Menu - Version 3.4.0

Version Description

  • Added filter support for custom post types
Download this release

Release Info

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

Code changes from version 3.3.0 to 3.4.0

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: 3.3.0
8
Author URI: http://lipeimagination.info
9
- Since: 7/16/12
10
Email: mat@lipeimagination.info
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: 3.4.0
8
Author URI: http://lipeimagination.info
9
+ Since: 10.5.12
10
Email: mat@lipeimagination.info
11
*/
12
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: Mat Lipe
3
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40lipeimagination%2einfo&lc=US&item_name=Advanced%20Sidebar%20Menu&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
4
Tags: menus, sidebar menu, heirchy, category menu, pages menu
5
Requires at least: 3.1
6
- Tested up to: 3.4.1
7
- Stable tag: 3.3.0
8
- Version: 3.3.0
9
10
== Description ==
11
@@ -85,6 +85,12 @@ You may want to use something like margins to set the levels apart.
85
86
87
== Changelog ==
88
= 3.3.0 =
89
* Added the ability to have a widget title
90
* Redesigned the entire structure to prepare for future changes
3
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40lipeimagination%2einfo&lc=US&item_name=Advanced%20Sidebar%20Menu&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
4
Tags: menus, sidebar menu, heirchy, category menu, pages menu
5
Requires at least: 3.1
6
+ Tested up to: 3.4.2
7
+ Stable tag: 3.4.0
8
+ Version: 3.4.0
9
10
== Description ==
11
85
86
87
== Changelog ==
88
+ = 3.4.0 =
89
+ * Added filter support for custom post types
90
+
91
+ = 3.3.1 =
92
+ * Added unlimited number of levels displayed once on the grandchild level of pages
93
+
94
= 3.3.0 =
95
* Added the ability to have a widget title
96
* Redesigned the entire structure to prepare for future changes
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
views/page_list.php CHANGED
@@ -5,7 +5,7 @@
5
/**
6
* The Ouput of tad Advanced Sidebar Page Widget
7
* @author Mat Lipe
8
- * @since 7/16/12
9
*
10
*
11
* @uses to edit, create a file named page_list.php and put in a folder in the your theme called 'advanced-sidebar-menu
@@ -18,7 +18,7 @@ $asm->title();
18
#-- list the parent page if chosen
19
if( $asm->include_parent() ){
20
echo '<ul class="parent-sidebar-menu" >';
21
- wp_list_pages("sort_column=menu_order&title_li=&echo=1&depth=1&include=".$top_parent);
22
}
23
24
@@ -29,7 +29,7 @@ if( $child_pages ){
29
#-- If they want all the pages displayed always
30
if( $asm->display_all() ){
31
32
- wp_list_pages("sort_column=menu_order&title_li=&echo=1&child_of=".$top_parent."&depth=".$instance['levels']."&exclude=".$instance['exclude']);
33
} else {
34
35
#-- Display children of current page's parent only
@@ -38,7 +38,7 @@ if( $child_pages ){
38
#-- If the page is not in the excluded ones
39
if( $asm->exclude( $pID->ID) ){
40
#--echo the current page from the $result
41
- wp_list_pages("sort_column=menu_order&title_li=&echo=1&depth=1&include=".$pID->ID);
42
}
43
44
#-- if the link that was just listed is the current page we are on
@@ -49,7 +49,7 @@ if( $child_pages ){
49
if( $grandkids ){
50
#-- Create a new menu with all the children under it
51
echo '<ul class="grandchild-sidebar-menu">';
52
- wp_list_pages("sort_column=menu_order&title_li=&echo=1&exclude=".$instance['exclude']."&depth=3&child_of=".$pID->ID);
53
54
echo '</ul>';
55
}
5
/**
6
* The Ouput of tad Advanced Sidebar Page Widget
7
* @author Mat Lipe
8
+ * @since 10.05.12
9
*
10
*
11
* @uses to edit, create a file named page_list.php and put in a folder in the your theme called 'advanced-sidebar-menu
18
#-- list the parent page if chosen
19
if( $asm->include_parent() ){
20
echo '<ul class="parent-sidebar-menu" >';
21
+ wp_list_pages("post_type=".$post_type."&sort_column=menu_order&title_li=&echo=1&depth=1&include=".$top_parent);
22
}
23
24
29
#-- If they want all the pages displayed always
30
if( $asm->display_all() ){
31
32
+ wp_list_pages("post_type=".$post_type."&sort_column=menu_order&title_li=&echo=1&child_of=".$top_parent."&depth=".$instance['levels']."&exclude=".$instance['exclude']);
33
} else {
34
35
#-- Display children of current page's parent only
38
#-- If the page is not in the excluded ones
39
if( $asm->exclude( $pID->ID) ){
40
#--echo the current page from the $result
41
+ wp_list_pages("post_type=".$post_type."&sort_column=menu_order&title_li=&echo=1&depth=1&include=".$pID->ID);
42
}
43
44
#-- if the link that was just listed is the current page we are on
49
if( $grandkids ){
50
#-- Create a new menu with all the children under it
51
echo '<ul class="grandchild-sidebar-menu">';
52
+ wp_list_pages("post_type=".$post_type."&sort_column=menu_order&title_li=&echo=1&exclude=".$instance['exclude']."&child_of=".$pID->ID);
53
54
echo '</ul>';
55
}
widgets/category.widget.php CHANGED
@@ -126,9 +126,14 @@ class advanced_sidebar_menu_category extends WP_Widget {
126
127
#---------------------------------------------------------------------------------------------------------------------------
128
129
- // adds the output to the widget area on the page
130
function widget($args, $instance) {
131
global $asm;
132
#-- Create a usable array of the excluded pages
133
$exclude = explode(',', $instance['exclude']);
134
$cat_ids = $already_top = array();
@@ -198,8 +203,8 @@ class advanced_sidebar_menu_category extends WP_Widget {
198
//Creates a new widget for each category the single page has if the options are selected to do so
199
if( !$asm_once || ($instance['new_widget'] == 'widget') ){
200
201
- echo '<div id="'.$args['widget_id']. $count .'" class="advanced-sidebar-menu widget advanced-sidebar-category">
202
- <div class="widget-wrap">';
203
204
$count++; // To change the id of the widget if there are multiple
205
$asm_once = true; //There has been a div
@@ -218,8 +223,7 @@ class advanced_sidebar_menu_category extends WP_Widget {
218
219
if( $close ){
220
//End the Widget Area
221
- echo '</div>
222
- </div><!-- END #advanced-sidebar-cat-menu -->';
223
}
224
225
126
127
#---------------------------------------------------------------------------------------------------------------------------
128
129
+ /**
130
+ * Outputs the categories widget to the page
131
+ * @since 10.5.12
132
+ *
133
+ */
134
function widget($args, $instance) {
135
global $asm;
136
+ extract( $args);
137
#-- Create a usable array of the excluded pages
138
$exclude = explode(',', $instance['exclude']);
139
$cat_ids = $already_top = array();
203
//Creates a new widget for each category the single page has if the options are selected to do so
204
if( !$asm_once || ($instance['new_widget'] == 'widget') ){
205
206
+ //Start the menu
207
+ echo $before_widget;
208
209
$count++; // To change the id of the widget if there are multiple
210
$asm_once = true; //There has been a div
223
224
if( $close ){
225
//End the Widget Area
226
+ echo $after_widget;
227
}
228
229
widgets/page.widget.php CHANGED
@@ -94,10 +94,26 @@ class advanced_sidebar_menu_page extends WP_Widget {
94
95
#---------------------------------------------------------------------------------------------------------------------------
96
97
- // adds the output to the widget area on the page
98
function widget($args, $instance) {
99
-
100
- if( is_page() ){
101
102
global $wpdb, $post, $table_prefix, $asm;
103
@@ -111,11 +127,11 @@ class advanced_sidebar_menu_page extends WP_Widget {
111
#--------- If this is the parent ------------------------------------------------
112
$top_parent = $post->ID;
113
}
114
-
115
/**
116
* Must be done this way to prevent doubling up of pages
117
*/
118
- $child_pages = $wpdb->get_results( "SELECT ID FROM ".$table_prefix."posts WHERE post_parent = $top_parent AND post_type='page' AND post_status='publish' Order by menu_order" );
119
120
//for depreciation
121
$p = $top_parent;
@@ -131,12 +147,11 @@ class advanced_sidebar_menu_page extends WP_Widget {
131
}
132
133
//Start the menu
134
- echo '<div id="'.$args['widget_id'].'" class="advanced-sidebar-menu widget advanced-sidebar-page">
135
- <div class="widget-wrap">';
136
$asm->set_widget_vars( $instance, $top_parent, $exclude );
137
#-- Bring in the view
138
require( $asm->file_hyercy( 'page_list.php' ) );
139
- echo '</div></div><!-- end #'.$args['widget_id'].' -->';
140
}
141
}
142
} #== /widget()
94
95
#---------------------------------------------------------------------------------------------------------------------------
96
97
+ /**
98
+ * Outputs the page list
99
+ * @see WP_Widget::widget()
100
+ * @uses for custom post types send the type to the filter titled 'advanced_sidebar_menu_post_type'
101
+ * @since 10.5.12
102
+ */
103
function widget($args, $instance) {
104
+ $single_type = 'page'; //default use is for pages
105
+
106
+ //Filter this one with a 'single' for a custom post type will default to working for pages only
107
+ $post_type = apply_filters('advanced_sidebar_menu_post_type', 'page' );
108
+
109
+
110
+ if( $post_type != 'page' ){
111
+ $single_type = 'single';
112
+ }
113
+
114
+ if( call_user_func('is_'.$single_type) ){
115
+
116
+ extract($args);
117
118
global $wpdb, $post, $table_prefix, $asm;
119
127
#--------- If this is the parent ------------------------------------------------
128
$top_parent = $post->ID;
129
}
130
+
131
/**
132
* Must be done this way to prevent doubling up of pages
133
*/
134
+ $child_pages = $wpdb->get_results( "SELECT ID FROM ".$table_prefix."posts WHERE post_parent = $top_parent AND post_status='publish' Order by menu_order" );
135
136
//for depreciation
137
$p = $top_parent;
147
}
148
149
//Start the menu
150
+ echo $before_widget;
151
$asm->set_widget_vars( $instance, $top_parent, $exclude );
152
#-- Bring in the view
153
require( $asm->file_hyercy( 'page_list.php' ) );
154
+ echo $after_widget;
155
}
156
}
157
} #== /widget()