Version Description
Download this release
Release Info
Developer | Mat Lipe |
Plugin | Advanced Sidebar Menu |
Version | 3.5.0 |
Comparing to | |
See all releases |
Code changes from version 3.4.7 to 3.5.0
- advanced-sidebar-menu.php +1 -1
- readme.txt +2 -2
- widgets/page.widget.php +28 -28
advanced-sidebar-menu.php
CHANGED
@@ -4,7 +4,7 @@ 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.12.12
|
10 |
Email: mat@lipeimagination.info
|
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.5.0
|
8 |
Author URI: http://lipeimagination.info
|
9 |
Since: 10.12.12
|
10 |
Email: mat@lipeimagination.info
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ 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¤cy_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.
|
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.
|
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¤cy_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.5.1
|
7 |
+
Stable tag: 3.5.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.
|
widgets/page.widget.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Creates a Widget of parent Child Pages
|
6 |
*
|
7 |
* @author mat lipe
|
8 |
-
* @since 10.
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*
|
11 |
*/
|
@@ -98,52 +98,52 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
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 |
-
* @
|
|
|
102 |
*/
|
103 |
function widget($args, $instance) {
|
104 |
-
$
|
105 |
-
|
|
|
106 |
|
107 |
//Filter this one with a 'single' for a custom post type will default to working for pages only
|
108 |
$post_type = apply_filters('advanced_sidebar_menu_post_type', 'page' );
|
109 |
|
110 |
|
111 |
if( $post_type != 'page' ){
|
112 |
-
$single_type = 'single';
|
113 |
add_filter('page_css_class', array( $asm, 'custom_post_type_css'), 2, 4 );
|
114 |
|
115 |
}
|
116 |
-
|
117 |
-
if( call_user_func('is_'.$single_type) ){
|
118 |
-
|
119 |
-
extract($args);
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
#-- Create a usable array of the excluded pages
|
124 |
-
$exclude = explode(',', $instance['exclude']);
|
125 |
|
126 |
-
|
127 |
-
|
128 |
$top_parent = end( $post->ancestors );
|
129 |
-
|
130 |
#--------- If this is the parent ------------------------------------------------
|
131 |
$top_parent = $post->ID;
|
132 |
-
|
|
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
*/
|
137 |
-
$child_pages = $wpdb->get_results( "SELECT ID FROM ".$table_prefix."posts WHERE post_parent = $top_parent AND post_status='publish' Order by menu_order" );
|
138 |
|
139 |
-
|
140 |
-
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
-
|
144 |
-
|
145 |
|
146 |
-
|
147 |
echo '<style type="text/css">';
|
148 |
include( advanced_sidebar_menu_functions::file_hyercy('sidebar-menu.css' ) );
|
149 |
echo '</style>';
|
@@ -155,8 +155,8 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
155 |
#-- Bring in the view
|
156 |
require( $asm->file_hyercy( 'page_list.php' ) );
|
157 |
echo $after_widget;
|
158 |
-
}
|
159 |
}
|
|
|
160 |
} #== /widget()
|
161 |
|
162 |
} #== /Clas
|
5 |
* Creates a Widget of parent Child Pages
|
6 |
*
|
7 |
* @author mat lipe
|
8 |
+
* @since 10.16.12
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*
|
11 |
*/
|
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 |
+
* @since 10.16.12
|
103 |
*/
|
104 |
function widget($args, $instance) {
|
105 |
+
global $wpdb, $post, $table_prefix, $asm;
|
106 |
+
|
107 |
+
extract($args);
|
108 |
|
109 |
//Filter this one with a 'single' for a custom post type will default to working for pages only
|
110 |
$post_type = apply_filters('advanced_sidebar_menu_post_type', 'page' );
|
111 |
|
112 |
|
113 |
if( $post_type != 'page' ){
|
|
|
114 |
add_filter('page_css_class', array( $asm, 'custom_post_type_css'), 2, 4 );
|
115 |
|
116 |
}
|
117 |
+
|
|
|
|
|
|
|
118 |
|
119 |
+
#-- Create a usable array of the excluded pages
|
120 |
+
$exclude = explode(',', $instance['exclude']);
|
|
|
|
|
121 |
|
122 |
+
#-- if the post has parents
|
123 |
+
if($post->ancestors){
|
124 |
$top_parent = end( $post->ancestors );
|
125 |
+
} else {
|
126 |
#--------- If this is the parent ------------------------------------------------
|
127 |
$top_parent = $post->ID;
|
128 |
+
}
|
129 |
+
|
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 ".$table_prefix."posts WHERE post_parent = $top_parent AND post_status='publish' AND post_type='".$post_type."' Order by menu_order" );
|
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 |
|
146 |
+
if( $instance['css'] == 'checked' ){
|
147 |
echo '<style type="text/css">';
|
148 |
include( advanced_sidebar_menu_functions::file_hyercy('sidebar-menu.css' ) );
|
149 |
echo '</style>';
|
155 |
#-- Bring in the view
|
156 |
require( $asm->file_hyercy( 'page_list.php' ) );
|
157 |
echo $after_widget;
|
|
|
158 |
}
|
159 |
+
|
160 |
} #== /widget()
|
161 |
|
162 |
} #== /Clas
|