Version Description
Download this release
Release Info
Developer | Mat Lipe |
Plugin | Advanced Sidebar Menu |
Version | 4.3.5 |
Comparing to | |
See all releases |
Code changes from version 4.3.4 to 4.3.5
- advanced-sidebar-menu.php +10 -16
- js/advanced-sidebar-menu.js +24 -0
- lib/advancedSidebarMenu.php +4 -3
- readme.txt +2 -2
- widgets/category.widget.php +34 -5
- widgets/page.widget.php +26 -8
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.3.
|
8 |
Author URI: http://lipeimagination.info
|
9 |
-
Since:
|
10 |
*/
|
11 |
|
12 |
|
@@ -25,19 +25,13 @@ $asm = new advancedSidebarMenu();
|
|
25 |
|
26 |
|
27 |
|
28 |
-
#-- Bring in the JQuery
|
29 |
-
add_action(
|
30 |
-
function advanced_sidebar_menu_script(){
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
);
|
38 |
-
|
39 |
};
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
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.3.5
|
8 |
Author URI: http://lipeimagination.info
|
9 |
+
Since: 8.1.13
|
10 |
*/
|
11 |
|
12 |
|
25 |
|
26 |
|
27 |
|
28 |
+
#-- Bring in the JQuery
|
29 |
+
add_action('admin_print_scripts', 'advanced_sidebar_menu_script');
|
30 |
+
function advanced_sidebar_menu_script() {
|
31 |
+
wp_enqueue_script(
|
32 |
+
apply_filters('asm_script', 'advanced-sidebar-menu-script'),
|
33 |
+
plugins_url('js/advanced-sidebar-menu.js', __FILE__),
|
34 |
+
array('jquery'),
|
35 |
+
'4.3.5'
|
|
|
36 |
);
|
|
|
37 |
};
|
|
|
|
|
|
|
|
js/advanced-sidebar-menu.js
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
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 |
*
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*/
|
@@ -129,7 +129,7 @@ class advancedSidebarMenu{
|
|
129 |
* @uses called by the widget view page_list.php
|
130 |
* @since 4.0
|
131 |
*
|
132 |
-
* @since
|
133 |
*/
|
134 |
function displayGrandChildMenu($page){
|
135 |
static $count = 0;
|
@@ -141,7 +141,8 @@ class advancedSidebarMenu{
|
|
141 |
//if there are no children of the current page bail
|
142 |
if( !$children = $this->page_children($page->ID) ) return;
|
143 |
|
144 |
-
|
|
|
145 |
foreach( $children as $child ){
|
146 |
|
147 |
//If this page should be excluded bail
|
4 |
/**
|
5 |
* These Functions are Specific to the Advanced Sidebar Menu
|
6 |
* @author Mat Lipe
|
7 |
+
* @since 8.1.13
|
8 |
*
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*/
|
129 |
* @uses called by the widget view page_list.php
|
130 |
* @since 4.0
|
131 |
*
|
132 |
+
* @since 8.1.13
|
133 |
*/
|
134 |
function displayGrandChildMenu($page){
|
135 |
static $count = 0;
|
141 |
//if there are no children of the current page bail
|
142 |
if( !$children = $this->page_children($page->ID) ) return;
|
143 |
|
144 |
+
|
145 |
+
$content = sprintf('<ul class="grandchild-sidebar-menu level-%s children">',$count );
|
146 |
foreach( $children as $child ){
|
147 |
|
148 |
//If this page should be excluded bail
|
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: 4.3.
|
8 |
|
9 |
Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
|
10 |
|
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.6.0
|
7 |
+
Stable tag: 4.3.5
|
8 |
|
9 |
Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
|
10 |
|
widgets/category.widget.php
CHANGED
@@ -5,16 +5,36 @@
|
|
5 |
* Creates a Widget of parent Child Categories
|
6 |
*
|
7 |
* @author mat lipe
|
8 |
-
* @since
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*
|
|
|
|
|
|
|
11 |
*/
|
12 |
class advanced_sidebar_menu_category extends WP_Widget {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
|
15 |
#-------------------------------------------------------------------------------------------------------------------------
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
18 |
function __construct() {
|
19 |
/* Widget settings. */
|
20 |
$widget_ops = array( 'classname' => 'advanced-sidebar-menu advanced-sidebar-category', 'description' => 'Creates a menu of all the Categories using the child/parent relationship' );
|
@@ -26,10 +46,19 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
26 |
|
27 |
|
28 |
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
function form( $instance ) {
|
32 |
-
|
|
|
|
|
33 |
?>
|
34 |
<p> Title <br>
|
35 |
<input id="<?php echo $this->get_field_name('title'); ?>"
|
5 |
* Creates a Widget of parent Child Categories
|
6 |
*
|
7 |
* @author mat lipe
|
8 |
+
* @since 8.1.13
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*
|
11 |
+
* @todo Clean this bad boy up. Still rookie code from years ago
|
12 |
+
*
|
13 |
+
*
|
14 |
*/
|
15 |
class advanced_sidebar_menu_category extends WP_Widget {
|
16 |
+
|
17 |
+
private $defaults = array(
|
18 |
+
'title' => false,
|
19 |
+
'include_parent' => false,
|
20 |
+
'include_childless_parent' => false,
|
21 |
+
'single' => false,
|
22 |
+
'css' => false,
|
23 |
+
'exclude' => false,
|
24 |
+
'new_widget' => 'list',
|
25 |
+
'legacy_mode' => false,
|
26 |
+
'display_all' => false,
|
27 |
+
'levels' => 1
|
28 |
+
);
|
29 |
|
30 |
|
31 |
#-------------------------------------------------------------------------------------------------------------------------
|
32 |
|
33 |
+
/**
|
34 |
+
* Build the widget like a Baller
|
35 |
+
*
|
36 |
+
* @since 8.1.13
|
37 |
+
*/
|
38 |
function __construct() {
|
39 |
/* Widget settings. */
|
40 |
$widget_ops = array( 'classname' => 'advanced-sidebar-menu advanced-sidebar-category', 'description' => 'Creates a menu of all the Categories using the child/parent relationship' );
|
46 |
|
47 |
|
48 |
|
49 |
+
/**
|
50 |
+
* Creates a form for the Widget Options
|
51 |
+
*
|
52 |
+
* @since 8.1.13
|
53 |
+
*
|
54 |
+
* @param array $instance
|
55 |
+
*
|
56 |
+
* @actions do_action('advanced_sidebar_menu_category_widget_form', $instance );
|
57 |
+
*/
|
58 |
function form( $instance ) {
|
59 |
+
|
60 |
+
$instance = wp_parse_args($instance, $this->defaults);
|
61 |
+
|
62 |
?>
|
63 |
<p> Title <br>
|
64 |
<input id="<?php echo $this->get_field_name('title'); ?>"
|
widgets/page.widget.php
CHANGED
@@ -1,18 +1,30 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
/**
|
5 |
* Creates a Widget of parent Child Pages
|
6 |
*
|
7 |
* @author mat lipe
|
8 |
-
* @since
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*
|
11 |
*/
|
12 |
class advanced_sidebar_menu_page extends WP_Widget {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
-
* Build the widget like a
|
16 |
*
|
17 |
* @since 4.5.13
|
18 |
*
|
@@ -34,9 +46,12 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
34 |
*
|
35 |
* @filters do_action('advanced_sidebar_menu_page_widget_form', $instance, $this->get_field_name('parent_only'), $this->get_field_id('parent_only'));
|
36 |
*
|
37 |
-
* @since
|
38 |
*/
|
39 |
function form( $instance ) {
|
|
|
|
|
|
|
40 |
?>
|
41 |
<p> Title <br>
|
42 |
<input id="<?php echo $this->get_field_id('title'); ?>"
|
@@ -105,7 +120,7 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
105 |
echo '</select></p></span>';
|
106 |
|
107 |
|
108 |
-
do_action('advanced_sidebar_menu_page_widget_form', $instance, $this->get_field_name('parent_only'), $this->get_field_id('parent_only'));
|
109 |
|
110 |
|
111 |
}
|
@@ -143,7 +158,9 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
143 |
* apply_filters('advanced_sidebar_menu_post_type', 'page', $args, $instance );
|
144 |
*
|
145 |
*
|
146 |
-
* @since
|
|
|
|
|
147 |
*/
|
148 |
function widget($args, $instance) {
|
149 |
global $wpdb, $post, $table_prefix;
|
@@ -174,7 +191,8 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
174 |
|
175 |
//Get the Top Parent Id
|
176 |
if($post->ancestors){
|
177 |
-
$
|
|
|
178 |
} else {
|
179 |
$top_parent = $post->ID;
|
180 |
}
|
1 |
<?php
|
|
|
|
|
2 |
/**
|
3 |
* Creates a Widget of parent Child Pages
|
4 |
*
|
5 |
* @author mat lipe
|
6 |
+
* @since 8.1.13
|
7 |
* @package Advanced Sidebar Menu
|
8 |
*
|
9 |
*/
|
10 |
class advanced_sidebar_menu_page extends WP_Widget {
|
11 |
+
|
12 |
+
private $defaults = array(
|
13 |
+
'title' => false,
|
14 |
+
'include_parent' => false,
|
15 |
+
'include_childless_parent' => false,
|
16 |
+
'order_by' => 'menu_order',
|
17 |
+
'css' => false,
|
18 |
+
'exclude' => false,
|
19 |
+
'legacy_mode' => false,
|
20 |
+
'display_all' => false,
|
21 |
+
'levels' => 1
|
22 |
+
);
|
23 |
+
|
24 |
+
|
25 |
|
26 |
/**
|
27 |
+
* Build the widget like a BOSS
|
28 |
*
|
29 |
* @since 4.5.13
|
30 |
*
|
46 |
*
|
47 |
* @filters do_action('advanced_sidebar_menu_page_widget_form', $instance, $this->get_field_name('parent_only'), $this->get_field_id('parent_only'));
|
48 |
*
|
49 |
+
* @since 8.1.13
|
50 |
*/
|
51 |
function form( $instance ) {
|
52 |
+
|
53 |
+
$instance = wp_parse_args($instance, $this->defaults);
|
54 |
+
|
55 |
?>
|
56 |
<p> Title <br>
|
57 |
<input id="<?php echo $this->get_field_id('title'); ?>"
|
120 |
echo '</select></p></span>';
|
121 |
|
122 |
|
123 |
+
do_action('advanced_sidebar_menu_page_widget_form', $instance, $this->get_field_name('parent_only'), $this->get_field_id('parent_only') );
|
124 |
|
125 |
|
126 |
}
|
158 |
* apply_filters('advanced_sidebar_menu_post_type', 'page', $args, $instance );
|
159 |
*
|
160 |
*
|
161 |
+
* @since 8.1.13
|
162 |
+
*
|
163 |
+
* @see Geansai - pointed out a notice level error. Thanks Geansai!!
|
164 |
*/
|
165 |
function widget($args, $instance) {
|
166 |
global $wpdb, $post, $table_prefix;
|
191 |
|
192 |
//Get the Top Parent Id
|
193 |
if($post->ancestors){
|
194 |
+
$ancestors = $post->ancestors;
|
195 |
+
$top_parent = end( $ancestors );
|
196 |
} else {
|
197 |
$top_parent = $post->ID;
|
198 |
}
|