Version Description
- Improve page list view
- Add advanced_sidebar_menu_list_pages_args filter
Download this release
Release Info
Developer | Mat Lipe |
Plugin | Advanced Sidebar Menu |
Version | 6.1.0 |
Comparing to | |
See all releases |
Code changes from version 6.0.0 to 6.1.0
- advanced-sidebar-menu.php +2 -4
- readme.txt +5 -1
- src/Advanced_Sidebar_Menu_List_Pages.php +17 -7
- views/page_list.php +9 -5
advanced-sidebar-menu.php
CHANGED
@@ -4,12 +4,12 @@ Plugin Name: Advanced Sidebar Menu
|
|
4 |
Plugin URI: https://matlipe.com/advanced-sidebar-menu/
|
5 |
Description: Creates dynamic menus based on parent/child relationship of your pages or categories.
|
6 |
Author: Mat Lipe
|
7 |
-
Version: 6.
|
8 |
Author URI: https://matlipe.com
|
9 |
Text Domain: advanced-sidebar-menu
|
10 |
*/
|
11 |
|
12 |
-
define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '6.
|
13 |
define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
|
14 |
|
15 |
if( !function_exists( 'advanced_sidebar_menu_load' ) ){
|
@@ -18,8 +18,6 @@ if( !function_exists( 'advanced_sidebar_menu_load' ) ){
|
|
18 |
require( ADVANCED_SIDEBAR_DIR . 'src/widgets/advanced_sidebar_menu_category.php' );
|
19 |
require( ADVANCED_SIDEBAR_DIR . 'src/widgets/advanced_sidebar_menu_page.php' );
|
20 |
|
21 |
-
//deprecated
|
22 |
-
|
23 |
//main src
|
24 |
require( ADVANCED_SIDEBAR_DIR . 'deprecated/Advanced_Sidebar_Menu_Menu_Deprecated.php' );
|
25 |
require( ADVANCED_SIDEBAR_DIR . 'src/Advanced_Sidebar_Menu.php' );
|
4 |
Plugin URI: https://matlipe.com/advanced-sidebar-menu/
|
5 |
Description: Creates dynamic menus based on parent/child relationship of your pages or categories.
|
6 |
Author: Mat Lipe
|
7 |
+
Version: 6.1.0
|
8 |
Author URI: https://matlipe.com
|
9 |
Text Domain: advanced-sidebar-menu
|
10 |
*/
|
11 |
|
12 |
+
define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '6.1.0' );
|
13 |
define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
|
14 |
|
15 |
if( !function_exists( 'advanced_sidebar_menu_load' ) ){
|
18 |
require( ADVANCED_SIDEBAR_DIR . 'src/widgets/advanced_sidebar_menu_category.php' );
|
19 |
require( ADVANCED_SIDEBAR_DIR . 'src/widgets/advanced_sidebar_menu_page.php' );
|
20 |
|
|
|
|
|
21 |
//main src
|
22 |
require( ADVANCED_SIDEBAR_DIR . 'deprecated/Advanced_Sidebar_Menu_Menu_Deprecated.php' );
|
23 |
require( ADVANCED_SIDEBAR_DIR . 'src/Advanced_Sidebar_Menu.php' );
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypa
|
|
5 |
Tags: menus, sidebar menu, hierarchy, category menu, pages menu
|
6 |
Requires at least: 4.2.0
|
7 |
Tested up to: 4.5.1
|
8 |
-
Stable tag: 6.
|
9 |
|
10 |
== Description ==
|
11 |
|
@@ -132,6 +132,10 @@ I do offer premium services for building custom add-ons for additional functiona
|
|
132 |
|
133 |
|
134 |
== Changelog ==
|
|
|
|
|
|
|
|
|
135 |
= 6.0.0 =
|
136 |
* Remove legacy template support
|
137 |
* Restructure plugin
|
5 |
Tags: menus, sidebar menu, hierarchy, category menu, pages menu
|
6 |
Requires at least: 4.2.0
|
7 |
Tested up to: 4.5.1
|
8 |
+
Stable tag: 6.1.0
|
9 |
|
10 |
== Description ==
|
11 |
|
132 |
|
133 |
|
134 |
== Changelog ==
|
135 |
+
= 6.1.0 =
|
136 |
+
* Improve page list view
|
137 |
+
* Add advanced_sidebar_menu_list_pages_args filter
|
138 |
+
|
139 |
= 6.0.0 =
|
140 |
* Remove legacy template support
|
141 |
* Restructure plugin
|
src/Advanced_Sidebar_Menu_List_Pages.php
CHANGED
@@ -105,11 +105,21 @@ class Advanced_Sidebar_Menu_List_Pages{
|
|
105 |
'levels' => $class->levels
|
106 |
);
|
107 |
|
108 |
-
$this->
|
109 |
|
110 |
}
|
111 |
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
/**
|
114 |
* __toString
|
115 |
*
|
@@ -124,19 +134,19 @@ class Advanced_Sidebar_Menu_List_Pages{
|
|
124 |
|
125 |
|
126 |
/**
|
127 |
-
* fill_class_vars
|
128 |
*
|
129 |
-
* Do any adjustments to class
|
130 |
*
|
131 |
-
* @param $args
|
132 |
*
|
133 |
* @return void
|
134 |
*/
|
135 |
-
private function
|
136 |
$defaults = array(
|
137 |
'depth' => 1,
|
138 |
'exclude' => '',
|
139 |
'echo' => 0,
|
|
|
140 |
'sort_column' => 'menu_order, post_title',
|
141 |
'walker' => new Advanced_Sidebar_Menu_Page_Walker(),
|
142 |
'hierarchical' => 0,
|
@@ -154,13 +164,13 @@ class Advanced_Sidebar_Menu_List_Pages{
|
|
154 |
}
|
155 |
$args[ 'exclude' ] = preg_replace( '/[^0-9,]/', '', implode( ',', apply_filters( 'wp_list_pages_excludes', $args[ 'exclude' ] ) ) );
|
156 |
|
157 |
-
$this->args = $args;
|
158 |
-
|
159 |
if ( is_page() || is_singular() ) {
|
160 |
$this->current_page = get_queried_object();
|
161 |
$this->current_page_id = $this->current_page->ID;
|
162 |
}
|
163 |
|
|
|
|
|
164 |
}
|
165 |
|
166 |
|
105 |
'levels' => $class->levels
|
106 |
);
|
107 |
|
108 |
+
$this->parse_args( $args );
|
109 |
|
110 |
}
|
111 |
|
112 |
|
113 |
+
/**
|
114 |
+
* Return the list of args that have been populated by this class
|
115 |
+
*
|
116 |
+
* @return array
|
117 |
+
*/
|
118 |
+
public function get_args(){
|
119 |
+
return $this->args;
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
/**
|
124 |
* __toString
|
125 |
*
|
134 |
|
135 |
|
136 |
/**
|
|
|
137 |
*
|
138 |
+
* Do any adjustments to class args here
|
139 |
*
|
140 |
+
* @param array $args
|
141 |
*
|
142 |
* @return void
|
143 |
*/
|
144 |
+
private function parse_args( $args ){
|
145 |
$defaults = array(
|
146 |
'depth' => 1,
|
147 |
'exclude' => '',
|
148 |
'echo' => 0,
|
149 |
+
'sort_order' => 'ASC',
|
150 |
'sort_column' => 'menu_order, post_title',
|
151 |
'walker' => new Advanced_Sidebar_Menu_Page_Walker(),
|
152 |
'hierarchical' => 0,
|
164 |
}
|
165 |
$args[ 'exclude' ] = preg_replace( '/[^0-9,]/', '', implode( ',', apply_filters( 'wp_list_pages_excludes', $args[ 'exclude' ] ) ) );
|
166 |
|
|
|
|
|
167 |
if ( is_page() || is_singular() ) {
|
168 |
$this->current_page = get_queried_object();
|
169 |
$this->current_page_id = $this->current_page->ID;
|
170 |
}
|
171 |
|
172 |
+
$this->args = apply_filters( 'advanced_sidebar_menu_list_pages_args', $args, $this );
|
173 |
+
|
174 |
}
|
175 |
|
176 |
|
views/page_list.php
CHANGED
@@ -4,12 +4,14 @@
|
|
4 |
*
|
5 |
* @author Mat Lipe
|
6 |
*
|
7 |
-
* @since
|
8 |
*
|
9 |
* @example to edit, create a file named page_list.php and put in a folder in the your theme called 'advanced-sidebar-menu.
|
10 |
* Copy the contents of the file into that file and edit at will.
|
11 |
* @notice Do not edit this file in its original location or it will break on upgrade
|
12 |
*/
|
|
|
|
|
13 |
|
14 |
/** @var Advanced_Sidebar_Menu_Menu $asm */
|
15 |
$asm->title();
|
@@ -17,7 +19,8 @@ $asm->title();
|
|
17 |
#-- list the parent page if chosen
|
18 |
if( $asm->include_parent() ){
|
19 |
$content .= '<ul class="parent-sidebar-menu" >';
|
20 |
-
$
|
|
|
21 |
}
|
22 |
|
23 |
|
@@ -27,11 +30,12 @@ if( $child_pages ){
|
|
27 |
|
28 |
#-- If they want all the pages displayed always
|
29 |
if( $asm->display_all() ){
|
30 |
-
|
|
|
|
|
|
|
31 |
|
32 |
} else {
|
33 |
-
|
34 |
-
$menu = new Advanced_Sidebar_Menu_List_Pages( $asm->top_id, $asm );
|
35 |
$content .= $menu->list_pages();
|
36 |
|
37 |
}
|
4 |
*
|
5 |
* @author Mat Lipe
|
6 |
*
|
7 |
+
* @since 6.1.0
|
8 |
*
|
9 |
* @example to edit, create a file named page_list.php and put in a folder in the your theme called 'advanced-sidebar-menu.
|
10 |
* Copy the contents of the file into that file and edit at will.
|
11 |
* @notice Do not edit this file in its original location or it will break on upgrade
|
12 |
*/
|
13 |
+
$menu = new Advanced_Sidebar_Menu_List_Pages( $asm->top_id, $asm );
|
14 |
+
$_args = $menu->get_args();
|
15 |
|
16 |
/** @var Advanced_Sidebar_Menu_Menu $asm */
|
17 |
$asm->title();
|
19 |
#-- list the parent page if chosen
|
20 |
if( $asm->include_parent() ){
|
21 |
$content .= '<ul class="parent-sidebar-menu" >';
|
22 |
+
$_args[ 'include' ] = $asm->top_id;
|
23 |
+
$content .= wp_list_pages( $_args );
|
24 |
}
|
25 |
|
26 |
|
30 |
|
31 |
#-- If they want all the pages displayed always
|
32 |
if( $asm->display_all() ){
|
33 |
+
unset( $_args[ 'include' ] );
|
34 |
+
$_args[ 'child_of' ] = $asm->top_id;
|
35 |
+
$_args[ 'depth' ] = $instance[ 'levels' ];
|
36 |
+
$content .= wp_list_pages( $_args );
|
37 |
|
38 |
} else {
|
|
|
|
|
39 |
$content .= $menu->list_pages();
|
40 |
|
41 |
}
|