Version Description
- Added a has_children class to page links with hidden children
Download this release
Release Info
Developer | Mat Lipe |
Plugin | Advanced Sidebar Menu |
Version | 4.4.0 |
Comparing to | |
See all releases |
Code changes from version 4.3.5 to 4.4.0
- advanced-sidebar-menu.js +0 -24
- advanced-sidebar-menu.php +3 -3
- lib/advancedSidebarMenu.php +50 -4
- readme.txt +4 -1
- widgets/page.widget.php +8 -2
advanced-sidebar-menu.js
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
//This will change the style display to block
|
4 |
-
//For the element that is sent to it
|
5 |
-
//Use the id or inline tags for this
|
6 |
-
function asm_reveal_element( this_element_id ){
|
7 |
-
|
8 |
-
//If the toggle has already been clicked to show
|
9 |
-
//This will hide it
|
10 |
-
if( document.getElementById( this_element_id ).style.display == 'none' ){
|
11 |
-
document.getElementById( this_element_id ).style.display = 'block';
|
12 |
-
//If the toggle has already been clicked to hide
|
13 |
-
//This will show it
|
14 |
-
} else {
|
15 |
-
document.getElementById( this_element_id ).style.display = 'none';
|
16 |
-
}
|
17 |
-
|
18 |
-
}
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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: 4.
|
8 |
Author URI: http://lipeimagination.info
|
9 |
-
Since: 8.
|
10 |
*/
|
11 |
|
12 |
|
@@ -32,6 +32,6 @@ function advanced_sidebar_menu_script() {
|
|
32 |
apply_filters('asm_script', 'advanced-sidebar-menu-script'),
|
33 |
plugins_url('js/advanced-sidebar-menu.js', __FILE__),
|
34 |
array('jquery'),
|
35 |
-
'4.
|
36 |
);
|
37 |
};
|
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: 4.4.0
|
8 |
Author URI: http://lipeimagination.info
|
9 |
+
Since: 8.29.13
|
10 |
*/
|
11 |
|
12 |
|
32 |
apply_filters('asm_script', 'advanced-sidebar-menu-script'),
|
33 |
plugins_url('js/advanced-sidebar-menu.js', __FILE__),
|
34 |
array('jquery'),
|
35 |
+
'4.4.0'
|
36 |
);
|
37 |
};
|
lib/advancedSidebarMenu.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
/**
|
5 |
* These Functions are Specific to the Advanced Sidebar Menu
|
6 |
* @author Mat Lipe
|
7 |
-
* @since 8.
|
8 |
*
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*/
|
@@ -20,6 +20,35 @@ class advancedSidebarMenu{
|
|
20 |
|
21 |
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
/**
|
24 |
* Checks if a widgets checkbox is checked.
|
25 |
* * this one is special and does a double check
|
@@ -172,10 +201,27 @@ class advancedSidebarMenu{
|
|
172 |
return $content;
|
173 |
|
174 |
}
|
|
|
175 |
|
176 |
-
|
177 |
-
|
178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
/**
|
181 |
* Adds the class for current page item etc to the page list when using a custom post type
|
4 |
/**
|
5 |
* These Functions are Specific to the Advanced Sidebar Menu
|
6 |
* @author Mat Lipe
|
7 |
+
* @since 8.29.13
|
8 |
*
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*/
|
20 |
|
21 |
|
22 |
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Check is a page has children by id
|
29 |
+
*
|
30 |
+
* @since 8.29.13
|
31 |
+
*
|
32 |
+
* @param int $postId
|
33 |
+
*/
|
34 |
+
function hasChildren($postId){
|
35 |
+
if( $this->post_type == 'page' ){
|
36 |
+
$children = get_pages("child_of=$postId");
|
37 |
+
} else {
|
38 |
+
$children = get_posts(array(
|
39 |
+
'post_type' => $this->post_type,
|
40 |
+
'post_parent' => $postId
|
41 |
+
) );
|
42 |
+
}
|
43 |
+
if( count( $children ) != 0 ) {
|
44 |
+
return true;
|
45 |
+
} else {
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
/**
|
53 |
* Checks if a widgets checkbox is checked.
|
54 |
* * this one is special and does a double check
|
201 |
return $content;
|
202 |
|
203 |
}
|
204 |
+
|
205 |
|
206 |
+
/**
|
207 |
+
* Adds the class for any menu item with children
|
208 |
+
*
|
209 |
+
* @param array $css the currrent css classes
|
210 |
+
* @param obj $page the page being checked
|
211 |
+
*
|
212 |
+
*
|
213 |
+
* @since 8.29.13
|
214 |
+
*
|
215 |
+
* @return array
|
216 |
+
*/
|
217 |
+
function hasChildrenClass($css, $page){
|
218 |
+
if( $this->hasChildren($page->ID) ){
|
219 |
+
$css[] = 'has_children';
|
220 |
+
}
|
221 |
+
|
222 |
+
return $css;
|
223 |
+
|
224 |
+
}
|
225 |
|
226 |
/**
|
227 |
* Adds the class for current page item etc to the page list when using a custom post type
|
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.6.0
|
7 |
-
Stable tag: 4.
|
8 |
|
9 |
Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
|
10 |
|
@@ -113,6 +113,9 @@ I do offer preminum services for buiding custom add-ons for additional functiona
|
|
113 |
|
114 |
|
115 |
== Changelog ==
|
|
|
|
|
|
|
116 |
= 4.3.0 =
|
117 |
* Added many filters into the category widget for things like taxonomies, parent category, display on override, order by, and much more. There is no UI support for any of this yet, but developers may now tap into this.
|
118 |
|
4 |
Tags: menus, sidebar menu, heirchy, category menu, pages menu
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 3.6.0
|
7 |
+
Stable tag: 4.4.0
|
8 |
|
9 |
Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
|
10 |
|
113 |
|
114 |
|
115 |
== Changelog ==
|
116 |
+
= 4.4.0 =
|
117 |
+
* Added a has_children class to page links with hidden children
|
118 |
+
|
119 |
= 4.3.0 =
|
120 |
* Added many filters into the category widget for things like taxonomies, parent category, display on override, order by, and much more. There is no UI support for any of this yet, but developers may now tap into this.
|
121 |
|
widgets/page.widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Creates a Widget of parent Child Pages
|
4 |
*
|
5 |
* @author mat lipe
|
6 |
-
* @since 8.
|
7 |
* @package Advanced Sidebar Menu
|
8 |
*
|
9 |
*/
|
@@ -158,7 +158,7 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
158 |
* apply_filters('advanced_sidebar_menu_post_type', 'page', $args, $instance );
|
159 |
*
|
160 |
*
|
161 |
-
* @since 8.
|
162 |
*
|
163 |
* @see Geansai - pointed out a notice level error. Thanks Geansai!!
|
164 |
*/
|
@@ -178,12 +178,18 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
178 |
//Filter this one with a 'single' for a custom post type will default to working for pages only
|
179 |
$post_type = apply_filters('advanced_sidebar_menu_post_type', 'page', $args, $instance );
|
180 |
$asm->post_type = $post_type;
|
|
|
|
|
|
|
|
|
|
|
181 |
if( $asm->post_type != 'page' ){
|
182 |
add_filter('page_css_class', array( $asm, 'custom_post_type_css'), 2, 4 );
|
183 |
}
|
184 |
|
185 |
|
186 |
|
|
|
187 |
$proper_single = !(is_single() || is_page() ) || (get_post_type() != $post_type);
|
188 |
//Filter the single post check if try to display the menu somewhere else like a category page
|
189 |
if( apply_filters('advanced_sidebar_menu_proper_single', $proper_single, $args, $instance) ) return;
|
3 |
* Creates a Widget of parent Child Pages
|
4 |
*
|
5 |
* @author mat lipe
|
6 |
+
* @since 8.29.13
|
7 |
* @package Advanced Sidebar Menu
|
8 |
*
|
9 |
*/
|
158 |
* apply_filters('advanced_sidebar_menu_post_type', 'page', $args, $instance );
|
159 |
*
|
160 |
*
|
161 |
+
* @since 8.29.13
|
162 |
*
|
163 |
* @see Geansai - pointed out a notice level error. Thanks Geansai!!
|
164 |
*/
|
178 |
//Filter this one with a 'single' for a custom post type will default to working for pages only
|
179 |
$post_type = apply_filters('advanced_sidebar_menu_post_type', 'page', $args, $instance );
|
180 |
$asm->post_type = $post_type;
|
181 |
+
|
182 |
+
//Add a has_children class to appropriate pages
|
183 |
+
add_filter('page_css_class', array( $asm, 'hasChildrenClass'), 2, 2 );
|
184 |
+
|
185 |
+
//Add the default classes to pages from a custom post type
|
186 |
if( $asm->post_type != 'page' ){
|
187 |
add_filter('page_css_class', array( $asm, 'custom_post_type_css'), 2, 4 );
|
188 |
}
|
189 |
|
190 |
|
191 |
|
192 |
+
|
193 |
$proper_single = !(is_single() || is_page() ) || (get_post_type() != $post_type);
|
194 |
//Filter the single post check if try to display the menu somewhere else like a category page
|
195 |
if( apply_filters('advanced_sidebar_menu_proper_single', $proper_single, $args, $instance) ) return;
|