Version Description
Download this release
Release Info
Developer | Mat Lipe |
Plugin | Advanced Sidebar Menu |
Version | 3.6.0 |
Comparing to | |
See all releases |
Code changes from version 3.5.0 to 3.6.0
- advanced-sidebar-menu.php +2 -3
- readme.txt +1 -1
- views/page_list.php +6 -9
- widgets/page.widget.php +12 -5
advanced-sidebar-menu.php
CHANGED
@@ -4,10 +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 |
|
13 |
#-- Bring in the functions
|
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.6.0
|
8 |
Author URI: http://lipeimagination.info
|
9 |
+
Since: 3.1.13
|
|
|
10 |
*/
|
11 |
|
12 |
#-- Bring in the functions
|
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: 3.
|
8 |
License: GPLv2
|
9 |
|
10 |
Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
|
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: 3.6.0
|
8 |
License: GPLv2
|
9 |
|
10 |
Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
|
views/page_list.php
CHANGED
@@ -1,11 +1,8 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
/**
|
6 |
-
* The Ouput of
|
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 +15,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("post_type=".$post_type."&sort_column
|
22 |
}
|
23 |
|
24 |
|
@@ -29,7 +26,7 @@ if( $child_pages ){
|
|
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
|
33 |
} else {
|
34 |
|
35 |
#-- Display children of current page's parent only
|
@@ -38,7 +35,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("post_type=".$post_type."&sort_column
|
42 |
}
|
43 |
|
44 |
#-- if the link that was just listed is the current page we are on
|
@@ -49,7 +46,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("post_type=".$post_type."&sort_column
|
53 |
|
54 |
echo '</ul>';
|
55 |
}
|
1 |
<?php
|
|
|
|
|
|
|
2 |
/**
|
3 |
+
* The Ouput of the Advanced Sidebar Page Widget
|
4 |
* @author Mat Lipe
|
5 |
+
* @since 3.1.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
|
15 |
#-- list the parent page if chosen
|
16 |
if( $asm->include_parent() ){
|
17 |
echo '<ul class="parent-sidebar-menu" >';
|
18 |
+
wp_list_pages("post_type=".$post_type."&sort_column=$order_by&title_li=&echo=1&depth=1&include=".$top_parent);
|
19 |
}
|
20 |
|
21 |
|
26 |
#-- If they want all the pages displayed always
|
27 |
if( $asm->display_all() ){
|
28 |
|
29 |
+
wp_list_pages("post_type=".$post_type."&sort_column=$order_by&title_li=&echo=1&child_of=".$top_parent."&depth=".$instance['levels']."&exclude=".$instance['exclude']);
|
30 |
} else {
|
31 |
|
32 |
#-- Display children of current page's parent only
|
35 |
#-- If the page is not in the excluded ones
|
36 |
if( $asm->exclude( $pID->ID) ){
|
37 |
#--echo the current page from the $result
|
38 |
+
wp_list_pages("post_type=".$post_type."&sort_column=$order_by&title_li=&echo=1&depth=1&include=".$pID->ID);
|
39 |
}
|
40 |
|
41 |
#-- if the link that was just listed is the current page we are on
|
46 |
if( $grandkids ){
|
47 |
#-- Create a new menu with all the children under it
|
48 |
echo '<ul class="grandchild-sidebar-menu">';
|
49 |
+
wp_list_pages("post_type=".$post_type."&sort_column=$order_by&title_li=&echo=1&exclude=".$instance['exclude']."&child_of=".$pID->ID);
|
50 |
|
51 |
echo '</ul>';
|
52 |
}
|
widgets/page.widget.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Creates a Widget of parent Child Pages
|
6 |
*
|
7 |
* @author mat lipe
|
8 |
-
* @since
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*
|
11 |
*/
|
@@ -97,9 +97,12 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
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 |
* @uses change the top parent manually with the filter 'advanced_sidebar_menu_top_parent'
|
102 |
-
* @
|
|
|
|
|
103 |
*/
|
104 |
function widget($args, $instance) {
|
105 |
global $wpdb, $post, $table_prefix, $asm;
|
@@ -130,16 +133,19 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
130 |
|
131 |
//Filter for specifying the top parent
|
132 |
$top_parent = apply_filters('advanced_sidebar_menu_top_parent', $top_parent, $post );
|
|
|
|
|
|
|
133 |
|
134 |
/**
|
135 |
* Must be done this way to prevent doubling up of pages
|
136 |
*/
|
137 |
-
$child_pages = $wpdb->get_results( "SELECT ID FROM "
|
138 |
|
139 |
//for depreciation
|
140 |
$p = $top_parent;
|
141 |
$result = $child_pages;
|
142 |
-
|
143 |
#---- if there are no children do not display the parent unless it is check to do so
|
144 |
if( ($child_pages) || (($instance['include_childless_parent'] == 'checked') && (!in_array($top_parent, $exclude)) ) ){
|
145 |
|
@@ -148,7 +154,8 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
148 |
include( advanced_sidebar_menu_functions::file_hyercy('sidebar-menu.css' ) );
|
149 |
echo '</style>';
|
150 |
}
|
151 |
-
|
|
|
152 |
//Start the menu
|
153 |
echo $before_widget;
|
154 |
$asm->set_widget_vars( $instance, $top_parent, $exclude );
|
5 |
* Creates a Widget of parent Child Pages
|
6 |
*
|
7 |
* @author mat lipe
|
8 |
+
* @since 3.1.13
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*
|
11 |
*/
|
97 |
/**
|
98 |
* Outputs the page list
|
99 |
* @see WP_Widget::widget()
|
100 |
+
*
|
101 |
* @uses for custom post types send the type to the filter titled 'advanced_sidebar_menu_post_type'
|
102 |
* @uses change the top parent manually with the filter 'advanced_sidebar_menu_top_parent'
|
103 |
+
* @uses change the order of the 2nd level pages with 'advanced_sidebar_menu_order_by' filter
|
104 |
+
*
|
105 |
+
* @since 3.1.13
|
106 |
*/
|
107 |
function widget($args, $instance) {
|
108 |
global $wpdb, $post, $table_prefix, $asm;
|
133 |
|
134 |
//Filter for specifying the top parent
|
135 |
$top_parent = apply_filters('advanced_sidebar_menu_top_parent', $top_parent, $post );
|
136 |
+
|
137 |
+
//Filter for specifiying the order by
|
138 |
+
$order_by = apply_filters('advanced_sidebar_menu_order_by', 'menu_order', $post );
|
139 |
|
140 |
/**
|
141 |
* Must be done this way to prevent doubling up of pages
|
142 |
*/
|
143 |
+
$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" );
|
144 |
|
145 |
//for depreciation
|
146 |
$p = $top_parent;
|
147 |
$result = $child_pages;
|
148 |
+
|
149 |
#---- if there are no children do not display the parent unless it is check to do so
|
150 |
if( ($child_pages) || (($instance['include_childless_parent'] == 'checked') && (!in_array($top_parent, $exclude)) ) ){
|
151 |
|
154 |
include( advanced_sidebar_menu_functions::file_hyercy('sidebar-menu.css' ) );
|
155 |
echo '</style>';
|
156 |
}
|
157 |
+
|
158 |
+
|
159 |
//Start the menu
|
160 |
echo $before_widget;
|
161 |
$asm->set_widget_vars( $instance, $top_parent, $exclude );
|