Version Description
- Added unlimited number of levels displayed once on the grandchild level of pages
Download this release
Release Info
Developer | Mat Lipe |
Plugin | Advanced Sidebar Menu |
Version | 3.3.1 |
Comparing to | |
See all releases |
Code changes from version 3.4.1 to 3.3.1
- advanced-sidebar-menu.php +2 -2
- functions.php +3 -3
- readme.txt +2 -5
- views/page_list.php +5 -5
- widgets/category.widget.php +6 -10
- widgets/page.widget.php +8 -23
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.
|
8 |
Author URI: http://lipeimagination.info
|
9 |
-
Since:
|
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.3.1
|
8 |
Author URI: http://lipeimagination.info
|
9 |
+
Since: 7/16/12
|
10 |
Email: mat@lipeimagination.info
|
11 |
*/
|
12 |
|
functions.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 |
|
10 |
|
@@ -132,11 +132,11 @@ function notice_3_3( ){
|
|
132 |
*
|
133 |
* Returns and array of all the children of a page
|
134 |
* @param int $pID the id of the page
|
135 |
-
* @since
|
136 |
*/
|
137 |
function page_children( $pID ){
|
138 |
global $wpdb, $table_prefix;
|
139 |
-
return $wpdb->get_results( "SELECT ID FROM ".$table_prefix."posts WHERE post_parent = ".$pID." AND post_status='publish'" );
|
140 |
|
141 |
}
|
142 |
|
4 |
/**
|
5 |
* These Functions are Specific to the Advanced Sidebar Menu
|
6 |
* @author Mat Lipe
|
7 |
+
* @since 7/16/12
|
8 |
*/
|
9 |
|
10 |
|
132 |
*
|
133 |
* Returns and array of all the children of a page
|
134 |
* @param int $pID the id of the page
|
135 |
+
* @since 7/19/12
|
136 |
*/
|
137 |
function page_children( $pID ){
|
138 |
global $wpdb, $table_prefix;
|
139 |
+
return $wpdb->get_results( "SELECT ID FROM ".$table_prefix."posts WHERE post_parent = ".$pID." AND post_type='page' AND post_status='publish'" );
|
140 |
|
141 |
}
|
142 |
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ 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.4.2
|
7 |
-
Stable tag: 3.
|
8 |
-
Version: 3.
|
9 |
|
10 |
== Description ==
|
11 |
|
@@ -85,9 +85,6 @@ You may want to use something like margins to set the levels apart.
|
|
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 |
|
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.3.1
|
8 |
+
Version: 3.3.0
|
9 |
|
10 |
== Description ==
|
11 |
|
85 |
|
86 |
|
87 |
== Changelog ==
|
|
|
|
|
|
|
88 |
= 3.3.1 =
|
89 |
* Added unlimited number of levels displayed once on the grandchild level of pages
|
90 |
|
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
|
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("
|
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("
|
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("
|
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("
|
53 |
|
54 |
echo '</ul>';
|
55 |
}
|
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 |
#-- 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 |
#-- 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 |
#-- 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 |
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']."&child_of=".$pID->ID);
|
53 |
|
54 |
echo '</ul>';
|
55 |
}
|
widgets/category.widget.php
CHANGED
@@ -117,7 +117,7 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
117 |
// This decides the name of the widget
|
118 |
function advanced_sidebar_menu_category( ) {
|
119 |
/* Widget settings. */
|
120 |
-
$widget_ops = array( 'classname' =>
|
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 );
|
@@ -126,14 +126,9 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
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,8 +198,8 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
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 |
-
|
207 |
-
|
208 |
|
209 |
$count++; // To change the id of the widget if there are multiple
|
210 |
$asm_once = true; //There has been a div
|
@@ -223,7 +218,8 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
223 |
|
224 |
if( $close ){
|
225 |
//End the Widget Area
|
226 |
-
|
|
|
227 |
}
|
228 |
|
229 |
|
117 |
// This decides the name of the widget
|
118 |
function advanced_sidebar_menu_category( ) {
|
119 |
/* Widget settings. */
|
120 |
+
$widget_ops = array( 'classname' => , '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 );
|
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 |
//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 |
|
219 |
if( $close ){
|
220 |
//End the Widget Area
|
221 |
+
echo '</div>
|
222 |
+
</div><!-- END #advanced-sidebar-cat-menu -->';
|
223 |
}
|
224 |
|
225 |
|
widgets/page.widget.php
CHANGED
@@ -94,26 +94,10 @@ class advanced_sidebar_menu_page extends WP_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 |
-
|
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,11 +111,11 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
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,11 +131,12 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
147 |
}
|
148 |
|
149 |
//Start the menu
|
150 |
-
echo
|
|
|
151 |
$asm->set_widget_vars( $instance, $top_parent, $exclude );
|
152 |
#-- Bring in the view
|
153 |
require( $asm->file_hyercy( 'page_list.php' ) );
|
154 |
-
echo
|
155 |
}
|
156 |
}
|
157 |
} #== /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 |
#--------- 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 |
}
|
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()
|