Version Description
- Remove legacy template support
- Restructure plugin
- Introduce 'advanced_sidebar_menu_template_part' filter
Download this release
Release Info
Developer | Mat Lipe |
Plugin | Advanced Sidebar Menu |
Version | 6.0.0 |
Comparing to | |
See all releases |
Code changes from version 5.1.4 to 6.0.0
- advanced-sidebar-menu.php +50 -42
- classes/Advanced_Sidebar_Menu_Deprecated.php → deprecated/Advanced_Sidebar_Menu_Menu_Deprecated.php +42 -2
- deprecated/advancedSidebarMenu.php +8 -0
- languages/advanced-sidebar-menu.pot +31 -30
- legacy/category_list.php +0 -65
- legacy/page_list.php +0 -72
- legacy/sidebar-menu.css +0 -34
- readme.txt +10 -2
- {js → resources/js}/advanced-sidebar-menu.js +0 -0
- src/Advanced_Sidebar_Menu.php +88 -0
- {classes → src}/Advanced_Sidebar_Menu_Cache.php +4 -4
- {classes → src}/Advanced_Sidebar_Menu_List_Pages.php +2 -2
- classes/advancedSidebarMenu.php → src/Advanced_Sidebar_Menu_Menu.php +3 -60
- {classes → src}/Advanced_Sidebar_Menu_Page_Walker.php +0 -0
- widgets/category.widget.php → src/widgets/advanced_sidebar_menu_category.php +20 -43
- widgets/page.widget.php → src/widgets/advanced_sidebar_menu_page.php +20 -15
- views/category_list.php +3 -1
- views/page_list.php +1 -1
- widgets/init.php +0 -24
advanced-sidebar-menu.php
CHANGED
@@ -4,68 +4,76 @@ 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:
|
8 |
Author URI: https://matlipe.com
|
9 |
Text Domain: advanced-sidebar-menu
|
10 |
*/
|
11 |
|
12 |
-
define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '
|
|
|
13 |
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
|
16 |
-
define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path(__FILE__) );
|
17 |
-
define( 'ADVANCED_SIDEBAR_WIDGETS_DIR', ADVANCED_SIDEBAR_DIR . 'widgets/' );
|
18 |
-
define( 'ADVANCED_SIDEBAR_VIEWS_DIR', ADVANCED_SIDEBAR_DIR . 'views/' );
|
19 |
-
define( 'ADVANCED_SIDEBAR_LEGACY_DIR', ADVANCED_SIDEBAR_DIR . 'legacy/' );
|
20 |
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
require( ADVANCED_SIDEBAR_DIR . 'classes/Advanced_Sidebar_Menu_Cache.php' );
|
30 |
|
31 |
-
|
32 |
-
$asm = new advancedSidebarMenu();
|
33 |
-
}
|
34 |
-
add_action( 'plugins_loaded', 'advanced_sidebar_menu_load' );
|
35 |
|
36 |
}
|
37 |
|
38 |
#-- Translate
|
39 |
-
add_action('plugins_loaded', 'advanced_sidebar_menu_translate' );
|
40 |
function advanced_sidebar_menu_translate(){
|
41 |
-
|
42 |
}
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
);
|
54 |
-
};
|
55 |
-
|
56 |
|
57 |
#-- Let know about new Pro Version
|
58 |
add_action( 'advanced_sidebar_menu_after_widget_form', 'advanced_sidebar_menu_pro_notice' );
|
59 |
function advanced_sidebar_menu_pro_notice(){
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
|
71 |
|
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.0.0
|
8 |
Author URI: https://matlipe.com
|
9 |
Text Domain: advanced-sidebar-menu
|
10 |
*/
|
11 |
|
12 |
+
define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '6.0.0' );
|
13 |
+
define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
|
14 |
|
15 |
+
if( !function_exists( 'advanced_sidebar_menu_load' ) ){
|
16 |
+
function advanced_sidebar_menu_load(){
|
17 |
+
//widgets
|
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' );
|
26 |
+
require( ADVANCED_SIDEBAR_DIR . 'src/Advanced_Sidebar_Menu_Menu.php' );
|
27 |
+
require( ADVANCED_SIDEBAR_DIR . 'deprecated/advancedSidebarMenu.php' );
|
28 |
|
29 |
+
require( ADVANCED_SIDEBAR_DIR . 'src/Advanced_Sidebar_Menu_Page_Walker.php' );
|
30 |
+
require( ADVANCED_SIDEBAR_DIR . 'src/Advanced_Sidebar_Menu_List_Pages.php' );
|
31 |
+
require( ADVANCED_SIDEBAR_DIR . 'src/Advanced_Sidebar_Menu_Cache.php' );
|
32 |
+
|
33 |
+
Advanced_Sidebar_Menu::init();
|
34 |
+
Advanced_Sidebar_Menu_Cache::init();
|
35 |
+
}
|
|
|
36 |
|
37 |
+
add_action( 'plugins_loaded', 'advanced_sidebar_menu_load' );
|
|
|
|
|
|
|
38 |
|
39 |
}
|
40 |
|
41 |
#-- Translate
|
42 |
+
add_action( 'plugins_loaded', 'advanced_sidebar_menu_translate' );
|
43 |
function advanced_sidebar_menu_translate(){
|
44 |
+
load_plugin_textdomain( 'advanced-sidebar-menu', false, 'advanced-sidebar-menu/languages' );
|
45 |
}
|
46 |
|
47 |
+
add_action( 'admin_print_scripts', 'advanced_sidebar_menu_script' );
|
48 |
+
function advanced_sidebar_menu_script(){
|
49 |
+
wp_enqueue_script(
|
50 |
+
apply_filters( 'asm_script', 'advanced-sidebar-menu-script' ),
|
51 |
+
plugins_url( 'resources/js/advanced-sidebar-menu.js', __FILE__ ),
|
52 |
+
array( 'jquery' ),
|
53 |
+
ADVANCED_SIDEBAR_BASIC_VERSION
|
54 |
+
);
|
55 |
+
}
|
|
|
|
|
|
|
56 |
|
57 |
#-- Let know about new Pro Version
|
58 |
add_action( 'advanced_sidebar_menu_after_widget_form', 'advanced_sidebar_menu_pro_notice' );
|
59 |
function advanced_sidebar_menu_pro_notice(){
|
60 |
+
if( defined( 'ADVANCED_SIDEBAR_MENU_PRO_VERSION' ) ){
|
61 |
+
return;
|
62 |
+
}
|
63 |
+
?>
|
64 |
+
<fieldset style="border: 1px solid black; border-radius: 10px; padding: 10px;">
|
65 |
+
<legend style="font-size: 14px; font-weight: bold;"><?php _e( 'Want More Options', 'advanced-sidebar-menu' ); ?>
|
66 |
+
?
|
67 |
+
</legend>
|
68 |
+
<p>
|
69 |
+
<strong><big>
|
70 |
+
<a target="blank" href="http://matlipe.com/product/advanced-sidebar-menu-pro/"><?php _e( 'Go Pro', 'advanced-sidebar-menu' ); ?>
|
71 |
+
!
|
72 |
+
</a>
|
73 |
+
</big></strong>
|
74 |
+
<p>
|
75 |
+
</fieldset>
|
76 |
+
<?php
|
77 |
}
|
78 |
|
79 |
|
classes/Advanced_Sidebar_Menu_Deprecated.php → deprecated/Advanced_Sidebar_Menu_Menu_Deprecated.php
RENAMED
@@ -7,7 +7,47 @@
|
|
7 |
*
|
8 |
* @see
|
9 |
*/
|
10 |
-
class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
|
13 |
/**
|
@@ -16,7 +56,7 @@ class Advanced_Sidebar_Menu_Deprecated {
|
|
16 |
function page_children( $pID ) {
|
17 |
global $wpdb, $table_prefix;
|
18 |
|
19 |
-
_deprecated_function( '
|
20 |
|
21 |
return $wpdb->get_results( "SELECT ID FROM " . $table_prefix . "posts WHERE post_parent = " . $pID . " AND post_type = $this->post_type AND post_status='publish' ORDER By " . $this->order_by );
|
22 |
|
7 |
*
|
8 |
* @see
|
9 |
*/
|
10 |
+
abstract class Advanced_Sidebar_Menu_Menu_Deprecated {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @deprecated 6.0.0
|
14 |
+
*/
|
15 |
+
static function file_hyercy( $file, $legacy = false ) {
|
16 |
+
if( $theme_file = locate_template( array( 'advanced-sidebar-menu/' . $file ) ) ){
|
17 |
+
$file = $theme_file;
|
18 |
+
} else {
|
19 |
+
$file = ADVANCED_SIDEBAR_DIR . 'views/' . $file;
|
20 |
+
}
|
21 |
+
|
22 |
+
return apply_filters( 'advanced_sidebar_menu_view_file', $file, $legacy );
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @see add_has_children_class
|
28 |
+
* @deprecated
|
29 |
+
*/
|
30 |
+
function hasChildrenClass( $classes, $page ) {
|
31 |
+
return $this->add_has_children_class( $classes, $page );
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @see has_children
|
37 |
+
* @deprecated
|
38 |
+
*/
|
39 |
+
function hasChildren( $post_id ){
|
40 |
+
return $this->has_children( $post_id );
|
41 |
+
}
|
42 |
+
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @see is_excluded
|
46 |
+
* @deprecated
|
47 |
+
*/
|
48 |
+
function exclude( $id ) {
|
49 |
+
return $this->is_excluded( $id );
|
50 |
+
}
|
51 |
|
52 |
|
53 |
/**
|
56 |
function page_children( $pID ) {
|
57 |
global $wpdb, $table_prefix;
|
58 |
|
59 |
+
_deprecated_function( 'Advanced_Sidebar_Menu_Menu::page_children', "5.0.0", 'Advanced_Sidebar_Menu_Menu::hasChildren' );
|
60 |
|
61 |
return $wpdb->get_results( "SELECT ID FROM " . $table_prefix . "posts WHERE post_parent = " . $pID . " AND post_type = $this->post_type AND post_status='publish' ORDER By " . $this->order_by );
|
62 |
|
deprecated/advancedSidebarMenu.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @deprecated 6.0.0
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class advancedSidebarMenu extends Advanced_Sidebar_Menu_Menu{
|
7 |
+
|
8 |
+
}
|
languages/advanced-sidebar-menu.pot
CHANGED
@@ -3,14 +3,14 @@ msgid ""
|
|
3 |
msgstr ""
|
4 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
5 |
"Project-Id-Version: Advanced Sidebar Menu\n"
|
6 |
-
"POT-Creation-Date:
|
7 |
-
"PO-Revision-Date:
|
8 |
"Last-Translator: \n"
|
9 |
"Language-Team: \n"
|
10 |
"MIME-Version: 1.0\n"
|
11 |
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
"Content-Transfer-Encoding: 8bit\n"
|
13 |
-
"X-Generator: Poedit 1.8.
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
"X-Poedit-WPHeader: advanced-sidebar-menu.php\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
@@ -20,88 +20,87 @@ msgstr ""
|
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
|
23 |
-
#: advanced-sidebar-menu.php:
|
24 |
msgid "Want More Options"
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: advanced-sidebar-menu.php:
|
28 |
msgid "Go Pro"
|
29 |
msgstr ""
|
30 |
|
31 |
-
#: widgets/
|
32 |
msgid ""
|
33 |
"Creates a menu of all the categories using the child/parent relationship"
|
34 |
msgstr ""
|
35 |
|
36 |
-
#: widgets/
|
37 |
msgid "Advanced Sidebar Categories Menu"
|
38 |
msgstr ""
|
39 |
|
40 |
-
#: widgets/
|
|
|
41 |
msgid "Title"
|
42 |
msgstr ""
|
43 |
|
44 |
-
#: widgets/
|
45 |
msgid "Include Parent Category"
|
46 |
msgstr ""
|
47 |
|
48 |
-
#: widgets/
|
|
|
49 |
msgid "Include Parent Even With No Children"
|
50 |
msgstr ""
|
51 |
|
52 |
-
#: widgets/
|
53 |
msgid "Use this plugins styling"
|
54 |
msgstr ""
|
55 |
|
56 |
-
#: widgets/
|
57 |
msgid "Display Categories on Single Posts"
|
58 |
msgstr ""
|
59 |
|
60 |
-
#: widgets/
|
61 |
msgid "Display Each Single Post's Category"
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: widgets/
|
65 |
msgid "Categories to Exclude, Comma Separated"
|
66 |
msgstr ""
|
67 |
|
68 |
-
#:
|
69 |
-
msgid "Legacy Mode: (use pre 4.0 structure and css)"
|
70 |
-
msgstr ""
|
71 |
-
|
72 |
-
#: widgets/category.widget.php:127
|
73 |
msgid "Always Display Child Categories"
|
74 |
msgstr ""
|
75 |
|
76 |
-
#:
|
|
|
77 |
msgid "Levels to Display"
|
78 |
msgstr ""
|
79 |
|
80 |
-
#: widgets/
|
81 |
msgid "Creates a menu of all the pages using the child/parent relationship"
|
82 |
msgstr ""
|
83 |
|
84 |
-
#: widgets/
|
85 |
msgid "Advanced Sidebar Pages Menu"
|
86 |
msgstr ""
|
87 |
|
88 |
-
#: widgets/
|
89 |
msgid "Include Parent Page"
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: widgets/
|
93 |
msgid "Order By"
|
94 |
msgstr ""
|
95 |
|
96 |
-
#: widgets/
|
97 |
msgid "Use this Plugin's Styling"
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: widgets/
|
101 |
msgid "Pages to Exclude (ids), Comma Separated"
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: widgets/
|
105 |
msgid "Always Display Child Pages"
|
106 |
msgstr ""
|
107 |
|
@@ -110,11 +109,13 @@ msgid "Advanced Sidebar Menu"
|
|
110 |
msgstr ""
|
111 |
|
112 |
#. Plugin URI of the plugin/theme
|
113 |
-
msgid "
|
114 |
msgstr ""
|
115 |
|
116 |
#. Description of the plugin/theme
|
117 |
-
msgid "
|
|
|
|
|
118 |
msgstr ""
|
119 |
|
120 |
#. Author of the plugin/theme
|
@@ -122,5 +123,5 @@ msgid "Mat Lipe"
|
|
122 |
msgstr ""
|
123 |
|
124 |
#. Author URI of the plugin/theme
|
125 |
-
msgid "
|
126 |
msgstr ""
|
3 |
msgstr ""
|
4 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
5 |
"Project-Id-Version: Advanced Sidebar Menu\n"
|
6 |
+
"POT-Creation-Date: 2016-05-03 10:55-0400\n"
|
7 |
+
"PO-Revision-Date: 2016-05-03 10:55-0400\n"
|
8 |
"Last-Translator: \n"
|
9 |
"Language-Team: \n"
|
10 |
"MIME-Version: 1.0\n"
|
11 |
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Generator: Poedit 1.8.7\n"
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
"X-Poedit-WPHeader: advanced-sidebar-menu.php\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
|
23 |
+
#: advanced-sidebar-menu.php:65
|
24 |
msgid "Want More Options"
|
25 |
msgstr ""
|
26 |
|
27 |
+
#: advanced-sidebar-menu.php:70
|
28 |
msgid "Go Pro"
|
29 |
msgstr ""
|
30 |
|
31 |
+
#: src/widgets/advanced_sidebar_menu_category.php:35
|
32 |
msgid ""
|
33 |
"Creates a menu of all the categories using the child/parent relationship"
|
34 |
msgstr ""
|
35 |
|
36 |
+
#: src/widgets/advanced_sidebar_menu_category.php:39
|
37 |
msgid "Advanced Sidebar Categories Menu"
|
38 |
msgstr ""
|
39 |
|
40 |
+
#: src/widgets/advanced_sidebar_menu_category.php:57
|
41 |
+
#: src/widgets/advanced_sidebar_menu_page.php:59
|
42 |
msgid "Title"
|
43 |
msgstr ""
|
44 |
|
45 |
+
#: src/widgets/advanced_sidebar_menu_category.php:64
|
46 |
msgid "Include Parent Category"
|
47 |
msgstr ""
|
48 |
|
49 |
+
#: src/widgets/advanced_sidebar_menu_category.php:71
|
50 |
+
#: src/widgets/advanced_sidebar_menu_page.php:72
|
51 |
msgid "Include Parent Even With No Children"
|
52 |
msgstr ""
|
53 |
|
54 |
+
#: src/widgets/advanced_sidebar_menu_category.php:77
|
55 |
msgid "Use this plugins styling"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: src/widgets/advanced_sidebar_menu_category.php:83
|
59 |
msgid "Display Categories on Single Posts"
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: src/widgets/advanced_sidebar_menu_category.php:96
|
63 |
msgid "Display Each Single Post's Category"
|
64 |
msgstr ""
|
65 |
|
66 |
+
#: src/widgets/advanced_sidebar_menu_category.php:113
|
67 |
msgid "Categories to Exclude, Comma Separated"
|
68 |
msgstr ""
|
69 |
|
70 |
+
#: src/widgets/advanced_sidebar_menu_category.php:118
|
|
|
|
|
|
|
|
|
71 |
msgid "Always Display Child Categories"
|
72 |
msgstr ""
|
73 |
|
74 |
+
#: src/widgets/advanced_sidebar_menu_category.php:131
|
75 |
+
#: src/widgets/advanced_sidebar_menu_page.php:121
|
76 |
msgid "Levels to Display"
|
77 |
msgstr ""
|
78 |
|
79 |
+
#: src/widgets/advanced_sidebar_menu_page.php:33
|
80 |
msgid "Creates a menu of all the pages using the child/parent relationship"
|
81 |
msgstr ""
|
82 |
|
83 |
+
#: src/widgets/advanced_sidebar_menu_page.php:40
|
84 |
msgid "Advanced Sidebar Pages Menu"
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: src/widgets/advanced_sidebar_menu_page.php:65
|
88 |
msgid "Include Parent Page"
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: src/widgets/advanced_sidebar_menu_page.php:78
|
92 |
msgid "Order By"
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: src/widgets/advanced_sidebar_menu_page.php:97
|
96 |
msgid "Use this Plugin's Styling"
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: src/widgets/advanced_sidebar_menu_page.php:103
|
100 |
msgid "Pages to Exclude (ids), Comma Separated"
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: src/widgets/advanced_sidebar_menu_page.php:108
|
104 |
msgid "Always Display Child Pages"
|
105 |
msgstr ""
|
106 |
|
109 |
msgstr ""
|
110 |
|
111 |
#. Plugin URI of the plugin/theme
|
112 |
+
msgid "https://matlipe.com/advanced-sidebar-menu/"
|
113 |
msgstr ""
|
114 |
|
115 |
#. Description of the plugin/theme
|
116 |
+
msgid ""
|
117 |
+
"Creates dynamic menus based on parent/child relationship of your pages or "
|
118 |
+
"categories."
|
119 |
msgstr ""
|
120 |
|
121 |
#. Author of the plugin/theme
|
123 |
msgstr ""
|
124 |
|
125 |
#. Author URI of the plugin/theme
|
126 |
+
msgid "https://matlipe.com"
|
127 |
msgstr ""
|
legacy/category_list.php
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* The Ouput of tad Advanced Sidebar Categories Widget
|
5 |
-
* @author Mat Lipe
|
6 |
-
* @since 7/16/12
|
7 |
-
*
|
8 |
-
*
|
9 |
-
* @uses to edit create a file named category_list.php and put in a folder in the your child theme called 'advanced-sidebar-menu
|
10 |
-
* @uses copy the contents of the file into that file and edit at will
|
11 |
-
* @param Do not edit this file in this location or it will break on update
|
12 |
-
*/
|
13 |
-
|
14 |
-
|
15 |
-
//Displays the title
|
16 |
-
$asm->title();
|
17 |
-
|
18 |
-
//Include the parent page if chosen
|
19 |
-
if( $asm->include_parent() ){
|
20 |
-
echo '<ul class="parent-sidebar-menu">';
|
21 |
-
wp_list_categories( 'title_li=&include=' . $top_cat);
|
22 |
-
}
|
23 |
-
//If there are children to display
|
24 |
-
if( !empty($all_categories) ){
|
25 |
-
echo '<ul class="child-sidebar-menu">';
|
26 |
-
|
27 |
-
#-- If they want all the child categories displayed always
|
28 |
-
if( $asm->display_all() ){
|
29 |
-
wp_list_categories('title_li=&child_of=' . $top_cat .'&depth=' .$instance['levels'] );
|
30 |
-
echo '</ul><!-- End #child-sidebar-menu -->';
|
31 |
-
|
32 |
-
} else {
|
33 |
-
|
34 |
-
#-- to Display the categories based a parent child relationship
|
35 |
-
foreach( $all_categories as $child_cat ){
|
36 |
-
|
37 |
-
//IF this is a child category of the top one
|
38 |
-
if( $asm->first_level_category( $child_cat ) ){
|
39 |
-
|
40 |
-
//List the child category and the children if it is the current one
|
41 |
-
wp_list_categories('title_li=&include=' . $child_cat->cat_ID . '&depth=1' );
|
42 |
-
|
43 |
-
|
44 |
-
//If there are children of this cat and it is a parent or child or the current cat
|
45 |
-
if( $asm->second_level_cat( $child_cat ) ){
|
46 |
-
#-- Create a new menu with all the children under it
|
47 |
-
echo '<ul class="grandchild-sidebar-menu">';
|
48 |
-
wp_list_categories("title_li=&exclude=".$instance['exclude']."&depth=3&child_of=" .$child_cat->cat_ID );
|
49 |
-
echo '</ul>';
|
50 |
-
|
51 |
-
}
|
52 |
-
}
|
53 |
-
} //End foreach
|
54 |
-
|
55 |
-
echo '</ul><!-- End #child-sidebar-menu -->';
|
56 |
-
|
57 |
-
} //End if display all is not checked
|
58 |
-
|
59 |
-
} //End if the are child categories
|
60 |
-
|
61 |
-
|
62 |
-
#-- if a parent category was displayed
|
63 |
-
if( $asm->include_parent() ){
|
64 |
-
echo '</ul><!-- End #parent-sidebar-menu -->';
|
65 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
legacy/page_list.php
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* The Ouput of the Advanced Sidebar Page Widget
|
4 |
-
*
|
5 |
-
* @author Mat Lipe
|
6 |
-
* @deprecated 3.1.13
|
7 |
-
*
|
8 |
-
* @see views/page_list.php which is the files used when not using legacy mode
|
9 |
-
*
|
10 |
-
* @example to edit, create a file named page_list.php and put in a folder in the your theme called 'advanced-sidebar-menu.
|
11 |
-
* Copy the contents of the file into that file and edit at will.
|
12 |
-
* Select Legacy in the widget options.
|
13 |
-
* @notice Do not edit this file in its original location or it will break on upgrade
|
14 |
-
*/
|
15 |
-
|
16 |
-
|
17 |
-
/** @var advancedSidebarMenu $asm */
|
18 |
-
$asm->title();
|
19 |
-
|
20 |
-
#-- list the parent page if chosen
|
21 |
-
if( $asm->include_parent() ){
|
22 |
-
echo '<ul class="parent-sidebar-menu" >';
|
23 |
-
wp_list_pages("post_type=".$asm->post_type."&sort_column=$asm->order_by&title_li=&echo=1&depth=1&include=".$asm->top_id);
|
24 |
-
}
|
25 |
-
|
26 |
-
|
27 |
-
//If there are children start the Child Sidebar Menu
|
28 |
-
if( $child_pages ){
|
29 |
-
echo '<ul class="child-sidebar-menu">';
|
30 |
-
|
31 |
-
#-- If they want all the pages displayed always
|
32 |
-
if( $asm->display_all() ){
|
33 |
-
|
34 |
-
wp_list_pages("post_type=".$asm->post_type."&sort_column=$asm->order_by&title_li=&echo=1&child_of=".$asm->top_id."&depth=".$instance['levels']."&exclude=".$instance['exclude']);
|
35 |
-
} else {
|
36 |
-
|
37 |
-
#-- Display children of current page's parent only
|
38 |
-
foreach($child_pages as $pID){
|
39 |
-
|
40 |
-
#-- If the page is not in the excluded ones
|
41 |
-
if( $asm->is_excluded( $pID ) ){
|
42 |
-
#--echo the current page from the $result
|
43 |
-
wp_list_pages("post_type=".$asm->post_type."&sort_column=$asm->order_by&title_li=&echo=1&depth=1&include=".$pID);
|
44 |
-
}
|
45 |
-
|
46 |
-
#-- if the link that was just listed is the current page we are on
|
47 |
-
if( $asm->page_ancestor( $pID ) ){
|
48 |
-
|
49 |
-
//Get the children of this page
|
50 |
-
$grandkids = $asm->page_children($pID);
|
51 |
-
if( $grandkids ){
|
52 |
-
#-- Create a new menu with all the children under it
|
53 |
-
echo '<ul class="grandchild-sidebar-menu">';
|
54 |
-
wp_list_pages("post_type=".$asm->post_type."&sort_column=$asm->order_by&title_li=&echo=1&exclude=".$instance['exclude']."&child_of=".$pID);
|
55 |
-
|
56 |
-
echo '</ul>';
|
57 |
-
}
|
58 |
-
}
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
#-- Close the First Level menu
|
63 |
-
echo '</ul><!-- End child-sidebar-menu -->';
|
64 |
-
|
65 |
-
}
|
66 |
-
if( $asm->include_parent() ) {
|
67 |
-
echo '</ul><!-- .parent-sidebar-menu -->';
|
68 |
-
}
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
legacy/sidebar-menu.css
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
.advanced-sidebar-menu ul li a{
|
2 |
-
font-weight: bold;
|
3 |
-
font-size: 130%;
|
4 |
-
text-decoration: none;
|
5 |
-
}
|
6 |
-
|
7 |
-
.advanced-sidebar-menu ul li a:hover{
|
8 |
-
text-decoration: underline;
|
9 |
-
}
|
10 |
-
|
11 |
-
.advanced-sidebar-menu ul ul li a{
|
12 |
-
font-weight: normal;
|
13 |
-
font-size: 100%;
|
14 |
-
}
|
15 |
-
|
16 |
-
.advanced-sidebar-menu ul{
|
17 |
-
margin: 0 0 0 18px;
|
18 |
-
list-style: none;
|
19 |
-
list-style-type: none;
|
20 |
-
}
|
21 |
-
|
22 |
-
.advanced-sidebar-menu ul li{
|
23 |
-
list-style:none;
|
24 |
-
list-style-type: none;
|
25 |
-
|
26 |
-
}
|
27 |
-
|
28 |
-
.advanced-sidebar-menu li.current_page_item{
|
29 |
-
list-style-type: disc;
|
30 |
-
}
|
31 |
-
|
32 |
-
.advanced-sidebar-menu li.current_page_item a{
|
33 |
-
font-weight: bold;
|
34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Contributors: Mat Lipe
|
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40matlipe%2ecom&lc=US&item_name=Advanced%20Sidebar%20Menu&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
|
5 |
Tags: menus, sidebar menu, hierarchy, category menu, pages menu
|
6 |
Requires at least: 4.2.0
|
7 |
-
Tested up to: 4.5.
|
8 |
-
Stable tag:
|
9 |
|
10 |
== Description ==
|
11 |
|
@@ -132,6 +132,12 @@ I do offer premium services for building custom add-ons for additional functiona
|
|
132 |
|
133 |
|
134 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
= 5.1.0 =
|
136 |
* Convert query over to get_posts() to allow for more extendability
|
137 |
* Implement object caching to improve performance for environments using external object caches
|
@@ -202,6 +208,8 @@ I do offer premium services for building custom add-ons for additional functiona
|
|
202 |
|
203 |
|
204 |
== Upgrade Notice ==
|
|
|
|
|
205 |
|
206 |
= 5.0.0 =
|
207 |
If you used a custom page_list.php template previously you may want to redo it on this version to take advantage of the new structure.
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40matlipe%2ecom&lc=US&item_name=Advanced%20Sidebar%20Menu&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
|
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.0.0
|
9 |
|
10 |
== Description ==
|
11 |
|
132 |
|
133 |
|
134 |
== Changelog ==
|
135 |
+
= 6.0.0 =
|
136 |
+
* Remove legacy template support
|
137 |
+
* Restructure plugin
|
138 |
+
* Introduce 'advanced_sidebar_menu_template_part' filter
|
139 |
+
|
140 |
+
|
141 |
= 5.1.0 =
|
142 |
* Convert query over to get_posts() to allow for more extendability
|
143 |
* Implement object caching to improve performance for environments using external object caches
|
208 |
|
209 |
|
210 |
== Upgrade Notice ==
|
211 |
+
= 6.0.0 =
|
212 |
+
If you are using the Pro version of this plugin be sure to update to Pro version 1.4.4 to keep all functionality intact with this version.
|
213 |
|
214 |
= 5.0.0 =
|
215 |
If you used a custom page_list.php template previously you may want to redo it on this version to take advantage of the new structure.
|
{js → resources/js}/advanced-sidebar-menu.js
RENAMED
File without changes
|
src/Advanced_Sidebar_Menu.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Advanced_Sidebar_Menu
|
6 |
+
*
|
7 |
+
* @author Mat Lipe
|
8 |
+
* @since 6.0.0
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
class Advanced_Sidebar_Menu {
|
12 |
+
|
13 |
+
private function hooks(){
|
14 |
+
add_action( 'widgets_init', array( $this, 'register_widgets' ) );
|
15 |
+
}
|
16 |
+
|
17 |
+
|
18 |
+
public function register_widgets(){
|
19 |
+
register_widget( "advanced_sidebar_menu_page" );
|
20 |
+
register_widget( "advanced_sidebar_menu_category" );
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Retrieve a template file from either the theme's 'advanced-sidebar-menu' directory
|
27 |
+
* or this plugins views folder if one does not exist
|
28 |
+
*
|
29 |
+
* @since 6.0.0
|
30 |
+
*
|
31 |
+
* @param string $file_name
|
32 |
+
*
|
33 |
+
* @return string
|
34 |
+
*/
|
35 |
+
public function get_template_part( $file_name ){
|
36 |
+
$file = locate_template( 'advanced-sidebar-menu/' . $file_name );
|
37 |
+
if( false == $file ){
|
38 |
+
$file = ADVANCED_SIDEBAR_DIR . 'views/' . $file_name;
|
39 |
+
}
|
40 |
+
|
41 |
+
//backward compatibility
|
42 |
+
$file = apply_filters( 'advanced_sidebar_menu_view_file', $file, false );
|
43 |
+
|
44 |
+
$_filter_args = array(
|
45 |
+
$file,
|
46 |
+
$file_name,
|
47 |
+
$this,
|
48 |
+
);
|
49 |
+
|
50 |
+
$file = apply_filters_ref_array( 'advanced_sidebar_menu_template_part', $_filter_args );
|
51 |
+
|
52 |
+
return $file;
|
53 |
+
}
|
54 |
+
|
55 |
+
//********** SINGLETON FUNCTIONS **********/
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Instance of this class for use as singleton
|
59 |
+
*/
|
60 |
+
private static $instance;
|
61 |
+
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Create the instance of the class
|
65 |
+
*
|
66 |
+
* @static
|
67 |
+
* @return void
|
68 |
+
*/
|
69 |
+
public static function init(){
|
70 |
+
self::get_instance()->hooks();
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Get (and instantiate, if necessary) the instance of the
|
76 |
+
* class
|
77 |
+
*
|
78 |
+
* @static
|
79 |
+
* @return self
|
80 |
+
*/
|
81 |
+
public static function get_instance(){
|
82 |
+
if( !is_a( self::$instance, __CLASS__ ) ){
|
83 |
+
self::$instance = new self();
|
84 |
+
}
|
85 |
+
|
86 |
+
return self::$instance;
|
87 |
+
}
|
88 |
+
}
|
{classes → src}/Advanced_Sidebar_Menu_Cache.php
RENAMED
@@ -36,7 +36,7 @@ class Advanced_Sidebar_Menu_Cache {
|
|
36 |
* Retrieve a posts child pages from the cache
|
37 |
* If no exist in the cache will return false
|
38 |
*
|
39 |
-
* @param
|
40 |
*
|
41 |
* @return array|false
|
42 |
*/
|
@@ -55,8 +55,8 @@ class Advanced_Sidebar_Menu_Cache {
|
|
55 |
* Add a post and its children to the cache
|
56 |
* Uses a global key for all posts so this appends to an array
|
57 |
*
|
58 |
-
* @param
|
59 |
-
* @param array
|
60 |
*
|
61 |
* @return void
|
62 |
*/
|
@@ -75,7 +75,7 @@ class Advanced_Sidebar_Menu_Cache {
|
|
75 |
* we serialize the whole object and hash it
|
76 |
*
|
77 |
*
|
78 |
-
* @param
|
79 |
*
|
80 |
* @return string
|
81 |
*/
|
36 |
* Retrieve a posts child pages from the cache
|
37 |
* If no exist in the cache will return false
|
38 |
*
|
39 |
+
* @param Advanced_Sidebar_Menu_Menu|Advanced_Sidebar_Menu_List_Pages $class
|
40 |
*
|
41 |
* @return array|false
|
42 |
*/
|
55 |
* Add a post and its children to the cache
|
56 |
* Uses a global key for all posts so this appends to an array
|
57 |
*
|
58 |
+
* @param Advanced_Sidebar_Menu_Menu|Advanced_Sidebar_Menu_List_Pages $class
|
59 |
+
* @param array $child_pages
|
60 |
*
|
61 |
* @return void
|
62 |
*/
|
75 |
* we serialize the whole object and hash it
|
76 |
*
|
77 |
*
|
78 |
+
* @param Advanced_Sidebar_Menu_Menu|Advanced_Sidebar_Menu_List_Pages $class
|
79 |
*
|
80 |
* @return string
|
81 |
*/
|
{classes → src}/Advanced_Sidebar_Menu_List_Pages.php
RENAMED
@@ -91,8 +91,8 @@ class Advanced_Sidebar_Menu_List_Pages{
|
|
91 |
*
|
92 |
* Used in the view
|
93 |
*
|
94 |
-
* @param int
|
95 |
-
* @param
|
96 |
*/
|
97 |
public function __construct( $parent_id, $class ){
|
98 |
|
91 |
*
|
92 |
* Used in the view
|
93 |
*
|
94 |
+
* @param int $parent_id - $asm->top_id
|
95 |
+
* @param Advanced_Sidebar_Menu_Menu $class
|
96 |
*/
|
97 |
public function __construct( $parent_id, $class ){
|
98 |
|
classes/advancedSidebarMenu.php → src/Advanced_Sidebar_Menu_Menu.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
* These Functions are Specific to the Advanced Sidebar Menu
|
6 |
*
|
@@ -8,7 +8,7 @@
|
|
8 |
*
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*/
|
11 |
-
class
|
12 |
|
13 |
var $instance; //The widget instance
|
14 |
var $top_id; //Either the top cat or page
|
@@ -268,11 +268,7 @@ class advancedSidebarMenu extends Advanced_Sidebar_Menu_Deprecated {
|
|
268 |
$title = apply_filters( 'widget_title', $this->instance[ 'title' ], $this->args, $this->instance );
|
269 |
$title = apply_filters( 'advanced_sidebar_menu_widget_title', $title, $this->args, $this->instance, $this );
|
270 |
|
271 |
-
|
272 |
-
echo '<h4 class="widgettitle">' . $title . '</h4>';
|
273 |
-
} else {
|
274 |
-
echo $this->args[ 'before_title' ] . $title . $this->args[ 'after_title' ];
|
275 |
-
}
|
276 |
}
|
277 |
|
278 |
}
|
@@ -307,58 +303,5 @@ class advancedSidebarMenu extends Advanced_Sidebar_Menu_Deprecated {
|
|
307 |
}
|
308 |
}
|
309 |
|
310 |
-
|
311 |
-
/**
|
312 |
-
* Allows for Overwriting files in the child theme
|
313 |
-
*
|
314 |
-
* @since 4.23.13
|
315 |
-
*
|
316 |
-
* @param string $file the name of the file to overwrite
|
317 |
-
*/
|
318 |
-
|
319 |
-
static function file_hyercy( $file, $legacy = false ) {
|
320 |
-
if( $theme_file = locate_template( array( 'advanced-sidebar-menu/' . $file ) ) ){
|
321 |
-
$file = $theme_file;
|
322 |
-
} elseif( $legacy ) {
|
323 |
-
$file = ADVANCED_SIDEBAR_LEGACY_DIR . $file;
|
324 |
-
} else {
|
325 |
-
$file = ADVANCED_SIDEBAR_VIEWS_DIR . $file;
|
326 |
-
}
|
327 |
-
|
328 |
-
return apply_filters( 'advanced_sidebar_menu_view_file', $file, $legacy );
|
329 |
-
|
330 |
-
}
|
331 |
-
|
332 |
-
/*************** Deprectated ***************/
|
333 |
-
|
334 |
-
/**
|
335 |
-
* @see add_has_children_class
|
336 |
-
* @deprecated
|
337 |
-
*/
|
338 |
-
function hasChildrenClass( $classes, $page ) {
|
339 |
-
return $this->add_has_children_class( $classes, $page );
|
340 |
-
}
|
341 |
-
|
342 |
-
|
343 |
-
/**
|
344 |
-
* @see has_children
|
345 |
-
* @deprecated
|
346 |
-
*/
|
347 |
-
function hasChildren( $post_id ){
|
348 |
-
return $this->has_children( $post_id );
|
349 |
-
}
|
350 |
-
|
351 |
-
|
352 |
-
/**
|
353 |
-
* @see is_excluded
|
354 |
-
* @deprecated
|
355 |
-
*/
|
356 |
-
function exclude( $id ) {
|
357 |
-
return $this->is_excluded( $id );
|
358 |
-
}
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
} //End class
|
364 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Advanced_Sidebar_Menu_Menu
|
4 |
*
|
5 |
* These Functions are Specific to the Advanced Sidebar Menu
|
6 |
*
|
8 |
*
|
9 |
* @package Advanced Sidebar Menu
|
10 |
*/
|
11 |
+
class Advanced_Sidebar_Menu_Menu extends Advanced_Sidebar_Menu_Menu_Deprecated {
|
12 |
|
13 |
var $instance; //The widget instance
|
14 |
var $top_id; //Either the top cat or page
|
268 |
$title = apply_filters( 'widget_title', $this->instance[ 'title' ], $this->args, $this->instance );
|
269 |
$title = apply_filters( 'advanced_sidebar_menu_widget_title', $title, $this->args, $this->instance, $this );
|
270 |
|
271 |
+
echo $this->args[ 'before_title' ] . $title . $this->args[ 'after_title' ];
|
|
|
|
|
|
|
|
|
272 |
}
|
273 |
|
274 |
}
|
303 |
}
|
304 |
}
|
305 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
} //End class
|
307 |
|
{classes → src}/Advanced_Sidebar_Menu_Page_Walker.php
RENAMED
File without changes
|
widgets/category.widget.php → src/widgets/advanced_sidebar_menu_category.php
RENAMED
@@ -15,16 +15,16 @@
|
|
15 |
class advanced_sidebar_menu_category extends WP_Widget {
|
16 |
|
17 |
private $defaults = array(
|
18 |
-
'title' =>
|
19 |
'include_parent' => false,
|
20 |
'include_childless_parent' => false,
|
21 |
-
'single' => false,
|
22 |
'css' => false,
|
23 |
-
'
|
24 |
-
'new_widget' => '
|
25 |
-
'
|
26 |
'display_all' => false,
|
27 |
-
'levels' => 1
|
|
|
28 |
);
|
29 |
|
30 |
|
@@ -32,7 +32,7 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
32 |
|
33 |
$widget_ops = array(
|
34 |
'classname' => 'advanced-sidebar-menu advanced-sidebar-category',
|
35 |
-
'description' => __( 'Creates a menu of all the categories using the child/parent relationship', 'advanced-sidebar-menu' )
|
36 |
);
|
37 |
$control_ops = array( 'width' => 290 );
|
38 |
|
@@ -110,20 +110,11 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
110 |
</span>
|
111 |
|
112 |
|
113 |
-
|
114 |
<p> <?php _e( "Categories to Exclude, Comma Separated", 'advanced-sidebar-menu' ); ?>:
|
115 |
<input id="<?php echo $this->get_field_name( 'exclude' ); ?>"
|
116 |
name="<?php echo $this->get_field_name( 'exclude' ); ?>" type="text" class="widefat" value="<?php echo $instance[ 'exclude' ]; ?>"/>
|
117 |
</p>
|
118 |
|
119 |
-
|
120 |
-
<p> <?php _e( "Legacy Mode: (use pre 4.0 structure and css)", 'advanced-sidebar-menu' ); ?>
|
121 |
-
<input id="<?php echo $this->get_field_name( 'legacy_mode' ); ?>"
|
122 |
-
name="<?php echo $this->get_field_name( 'legacy_mode' ); ?>" type="checkbox" value="checked"
|
123 |
-
<?php echo $instance[ 'legacy_mode' ]; ?>/>
|
124 |
-
</p>
|
125 |
-
|
126 |
-
|
127 |
<p> <?php _e( "Always Display Child Categories", 'advanced-sidebar-menu' ); ?>
|
128 |
<input id="<?php echo $this->get_field_name( 'display_all' ); ?>"
|
129 |
name="<?php echo $this->get_field_name( 'display_all' ); ?>" type="checkbox" value="checked"
|
@@ -160,7 +151,8 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
160 |
/**
|
161 |
* Updates the widget data
|
162 |
*
|
163 |
-
* @filter - $newInstance = apply_filters('advanced_sidebar_menu_category_widget_update', $newInstance,
|
|
|
164 |
* @since 5.19.13
|
165 |
*/
|
166 |
function update( $newInstance, $oldInstance ){
|
@@ -189,26 +181,12 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
189 |
*/
|
190 |
function widget( $args, $instance ){
|
191 |
|
192 |
-
$
|
193 |
-
'title' => '',
|
194 |
-
'include_parent' => false,
|
195 |
-
'include_childless_parent' => false,
|
196 |
-
'css' => false,
|
197 |
-
'single' => false,
|
198 |
-
'new_widget' => 'widget',
|
199 |
-
'exclude' => '',
|
200 |
-
'legacy_mode' => false,
|
201 |
-
'display_all' => false,
|
202 |
-
'levels' => 1,
|
203 |
-
'order' => 'DESC'
|
204 |
-
);
|
205 |
-
|
206 |
-
$instance = wp_parse_args( $instance, $defaults );
|
207 |
|
208 |
if( is_single() && !isset( $instance[ 'single' ] ) ){
|
209 |
return;
|
210 |
}
|
211 |
-
$asm = new
|
212 |
$asm->instance = $instance;
|
213 |
$asm->args = $args;
|
214 |
|
@@ -216,8 +194,7 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
216 |
$asm->order_by = apply_filters( 'advanced_sidebar_menu_category_orderby', null, $args, $instance );
|
217 |
|
218 |
do_action( 'advanced_sidebar_menu_widget_pre_render', $asm, $this );
|
219 |
-
|
220 |
-
$legacy = $asm->checked( 'legacy_mode' );
|
221 |
|
222 |
$cat_ids = $already_top = array();
|
223 |
$asm_once = false; //keeps track of how many widgets this created
|
@@ -243,14 +220,14 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
243 |
uasort( $category_array, array( $asm, 'sortTerms' ) );
|
244 |
|
245 |
foreach( $category_array as $id => $cat ){
|
246 |
-
$cat_ids[
|
247 |
}
|
248 |
|
249 |
//IF on a category page get the id of the category
|
250 |
} elseif( is_tax() || is_category() ) {
|
251 |
|
252 |
$asm->current_term = get_queried_object()->term_id;
|
253 |
-
$cat_ids[
|
254 |
}
|
255 |
|
256 |
$cat_ids = apply_filters( 'advanced_sidebar_menu_category_ids', $cat_ids, $args, $instance );
|
@@ -270,7 +247,7 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
270 |
continue;
|
271 |
}
|
272 |
|
273 |
-
$already_top[
|
274 |
|
275 |
//Check for children
|
276 |
$all_categories = $all = array_filter(
|
@@ -278,7 +255,7 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
278 |
$asm->taxonomy, array(
|
279 |
'child_of' => $asm->top_id,
|
280 |
'orderby' => $asm->order_by,
|
281 |
-
'order' => $instance[ 'order' ]
|
282 |
)
|
283 |
)
|
284 |
);
|
@@ -304,10 +281,12 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
304 |
//Start the menu
|
305 |
echo $before_widget;
|
306 |
if( !$asm_once ){
|
|
|
307 |
$asm->title();
|
|
|
308 |
if( $asm->checked( 'css' ) ){
|
309 |
echo '<style type="text/css">';
|
310 |
-
include(
|
311 |
echo '</style>';
|
312 |
}
|
313 |
|
@@ -325,7 +304,7 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
325 |
$cat_ancestors = $asm->ancestors;
|
326 |
|
327 |
//Bring in the view
|
328 |
-
require(
|
329 |
|
330 |
echo apply_filters( 'advanced_sidebar_menu_category_widget_output', $content, $args, $instance );
|
331 |
|
@@ -335,7 +314,6 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
335 |
echo '<!-- First $after_widget -->';
|
336 |
}
|
337 |
|
338 |
-
|
339 |
} //End of each cat loop
|
340 |
|
341 |
//IF we were waiting for all the individual lists to complete
|
@@ -346,7 +324,6 @@ class advanced_sidebar_menu_category extends WP_Widget {
|
|
346 |
|
347 |
}
|
348 |
|
349 |
-
|
350 |
} #== /widget()
|
351 |
|
352 |
} #== /Clas
|
15 |
class advanced_sidebar_menu_category extends WP_Widget {
|
16 |
|
17 |
private $defaults = array(
|
18 |
+
'title' => '',
|
19 |
'include_parent' => false,
|
20 |
'include_childless_parent' => false,
|
|
|
21 |
'css' => false,
|
22 |
+
'single' => false,
|
23 |
+
'new_widget' => 'widget',
|
24 |
+
'exclude' => '',
|
25 |
'display_all' => false,
|
26 |
+
'levels' => 1,
|
27 |
+
'order' => 'DESC',
|
28 |
);
|
29 |
|
30 |
|
32 |
|
33 |
$widget_ops = array(
|
34 |
'classname' => 'advanced-sidebar-menu advanced-sidebar-category',
|
35 |
+
'description' => __( 'Creates a menu of all the categories using the child/parent relationship', 'advanced-sidebar-menu' ),
|
36 |
);
|
37 |
$control_ops = array( 'width' => 290 );
|
38 |
|
110 |
</span>
|
111 |
|
112 |
|
|
|
113 |
<p> <?php _e( "Categories to Exclude, Comma Separated", 'advanced-sidebar-menu' ); ?>:
|
114 |
<input id="<?php echo $this->get_field_name( 'exclude' ); ?>"
|
115 |
name="<?php echo $this->get_field_name( 'exclude' ); ?>" type="text" class="widefat" value="<?php echo $instance[ 'exclude' ]; ?>"/>
|
116 |
</p>
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
<p> <?php _e( "Always Display Child Categories", 'advanced-sidebar-menu' ); ?>
|
119 |
<input id="<?php echo $this->get_field_name( 'display_all' ); ?>"
|
120 |
name="<?php echo $this->get_field_name( 'display_all' ); ?>" type="checkbox" value="checked"
|
151 |
/**
|
152 |
* Updates the widget data
|
153 |
*
|
154 |
+
* @filter - $newInstance = apply_filters('advanced_sidebar_menu_category_widget_update', $newInstance,
|
155 |
+
* $oldInstance );
|
156 |
* @since 5.19.13
|
157 |
*/
|
158 |
function update( $newInstance, $oldInstance ){
|
181 |
*/
|
182 |
function widget( $args, $instance ){
|
183 |
|
184 |
+
$instance = wp_parse_args( $instance, $this->defaults );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
|
186 |
if( is_single() && !isset( $instance[ 'single' ] ) ){
|
187 |
return;
|
188 |
}
|
189 |
+
$asm = new Advanced_Sidebar_Menu_Menu;
|
190 |
$asm->instance = $instance;
|
191 |
$asm->args = $args;
|
192 |
|
194 |
$asm->order_by = apply_filters( 'advanced_sidebar_menu_category_orderby', null, $args, $instance );
|
195 |
|
196 |
do_action( 'advanced_sidebar_menu_widget_pre_render', $asm, $this );
|
197 |
+
|
|
|
198 |
|
199 |
$cat_ids = $already_top = array();
|
200 |
$asm_once = false; //keeps track of how many widgets this created
|
220 |
uasort( $category_array, array( $asm, 'sortTerms' ) );
|
221 |
|
222 |
foreach( $category_array as $id => $cat ){
|
223 |
+
$cat_ids[] = $cat->term_id;
|
224 |
}
|
225 |
|
226 |
//IF on a category page get the id of the category
|
227 |
} elseif( is_tax() || is_category() ) {
|
228 |
|
229 |
$asm->current_term = get_queried_object()->term_id;
|
230 |
+
$cat_ids[] = get_queried_object()->term_id;
|
231 |
}
|
232 |
|
233 |
$cat_ids = apply_filters( 'advanced_sidebar_menu_category_ids', $cat_ids, $args, $instance );
|
247 |
continue;
|
248 |
}
|
249 |
|
250 |
+
$already_top[] = $asm->top_id;
|
251 |
|
252 |
//Check for children
|
253 |
$all_categories = $all = array_filter(
|
255 |
$asm->taxonomy, array(
|
256 |
'child_of' => $asm->top_id,
|
257 |
'orderby' => $asm->order_by,
|
258 |
+
'order' => $instance[ 'order' ],
|
259 |
)
|
260 |
)
|
261 |
);
|
281 |
//Start the menu
|
282 |
echo $before_widget;
|
283 |
if( !$asm_once ){
|
284 |
+
//must remain in the loop instead of the template because we only want it to display once
|
285 |
$asm->title();
|
286 |
+
|
287 |
if( $asm->checked( 'css' ) ){
|
288 |
echo '<style type="text/css">';
|
289 |
+
include( Advanced_Sidebar_Menu::get_instance()->get_template_part( 'sidebar-menu.css' ) );
|
290 |
echo '</style>';
|
291 |
}
|
292 |
|
304 |
$cat_ancestors = $asm->ancestors;
|
305 |
|
306 |
//Bring in the view
|
307 |
+
require( Advanced_Sidebar_Menu::get_instance()->get_template_part( 'category_list.php' ) );
|
308 |
|
309 |
echo apply_filters( 'advanced_sidebar_menu_category_widget_output', $content, $args, $instance );
|
310 |
|
314 |
echo '<!-- First $after_widget -->';
|
315 |
}
|
316 |
|
|
|
317 |
} //End of each cat loop
|
318 |
|
319 |
//IF we were waiting for all the individual lists to complete
|
324 |
|
325 |
}
|
326 |
|
|
|
327 |
} #== /widget()
|
328 |
|
329 |
} #== /Clas
|
widgets/page.widget.php → src/widgets/advanced_sidebar_menu_page.php
RENAMED
@@ -21,7 +21,6 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
21 |
'order_by' => 'menu_order',
|
22 |
'css' => false,
|
23 |
'exclude' => false,
|
24 |
-
'legacy_mode' => false,
|
25 |
'display_all' => false,
|
26 |
'levels' => 1
|
27 |
);
|
@@ -106,12 +105,6 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
106 |
name="<?php echo $this->get_field_name( 'exclude' ); ?>" class="widefat" type="text" value="<?php echo $instance[ 'exclude' ]; ?>"/>
|
107 |
</p>
|
108 |
|
109 |
-
<p> <?php _e( "Legacy Mode: (use pre 4.0 structure and css)", 'advanced-sidebar-menu' ); ?>
|
110 |
-
<input id="<?php echo $this->get_field_name( 'legacy_mode' ); ?>"
|
111 |
-
name="<?php echo $this->get_field_name( 'legacy_mode' ); ?>" type="checkbox" value="checked"
|
112 |
-
<?php echo $instance[ 'legacy_mode' ]; ?>/>
|
113 |
-
</p>
|
114 |
-
|
115 |
<p> <?php _e( "Always Display Child Pages", 'advanced-sidebar-menu' ); ?>:
|
116 |
<input id="<?php echo $this->get_field_id( 'display_all' ); ?>"
|
117 |
name="<?php echo $this->get_field_name( 'display_all' ); ?>" type="checkbox" value="checked"
|
@@ -185,7 +178,7 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
185 |
function widget( $args, $instance ){
|
186 |
global $post;
|
187 |
|
188 |
-
$asm = new
|
189 |
$asm->instance = $instance;
|
190 |
$asm->args = $args;
|
191 |
$asm->exclude = apply_filters( 'advanced_sidebar_menu_excluded_pages', explode( ',', $instance[ 'exclude' ] ), $post, $asm->args, $asm->instance, $asm );
|
@@ -240,18 +233,16 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
240 |
#---- if there are no children do not display the parent unless it is check to do so
|
241 |
if( ( !empty( $child_pages ) ) || $asm->checked( 'include_childless_parent' ) && ( !in_array( $top_parent, $asm->exclude ) ) ){
|
242 |
|
243 |
-
$legacy = $asm->checked( 'legacy_mode' );
|
244 |
-
|
245 |
if( $asm->checked( 'css' ) ){
|
246 |
echo '<style type="text/css">';
|
247 |
-
include(
|
248 |
echo '</style>';
|
249 |
}
|
250 |
|
251 |
echo $args[ 'before_widget' ];
|
252 |
|
253 |
$content = '';
|
254 |
-
require(
|
255 |
echo apply_filters( 'advanced_sidebar_menu_page_widget_output', $content, $args, $instance );
|
256 |
echo $args[ 'after_widget' ];
|
257 |
|
@@ -265,8 +256,8 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
265 |
*
|
266 |
* Get the children's ids of the top level parent
|
267 |
*
|
268 |
-
* @param
|
269 |
-
* @param array
|
270 |
*
|
271 |
* @filter advanced_sidebar_menu_child_pages
|
272 |
*
|
@@ -295,7 +286,21 @@ class advanced_sidebar_menu_page extends WP_Widget {
|
|
295 |
}
|
296 |
|
297 |
$filter_args[ 0 ] = $child_pages;
|
298 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
|
300 |
return $child_pages;
|
301 |
|
21 |
'order_by' => 'menu_order',
|
22 |
'css' => false,
|
23 |
'exclude' => false,
|
|
|
24 |
'display_all' => false,
|
25 |
'levels' => 1
|
26 |
);
|
105 |
name="<?php echo $this->get_field_name( 'exclude' ); ?>" class="widefat" type="text" value="<?php echo $instance[ 'exclude' ]; ?>"/>
|
106 |
</p>
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
<p> <?php _e( "Always Display Child Pages", 'advanced-sidebar-menu' ); ?>:
|
109 |
<input id="<?php echo $this->get_field_id( 'display_all' ); ?>"
|
110 |
name="<?php echo $this->get_field_name( 'display_all' ); ?>" type="checkbox" value="checked"
|
178 |
function widget( $args, $instance ){
|
179 |
global $post;
|
180 |
|
181 |
+
$asm = new Advanced_Sidebar_Menu_Menu();
|
182 |
$asm->instance = $instance;
|
183 |
$asm->args = $args;
|
184 |
$asm->exclude = apply_filters( 'advanced_sidebar_menu_excluded_pages', explode( ',', $instance[ 'exclude' ] ), $post, $asm->args, $asm->instance, $asm );
|
233 |
#---- if there are no children do not display the parent unless it is check to do so
|
234 |
if( ( !empty( $child_pages ) ) || $asm->checked( 'include_childless_parent' ) && ( !in_array( $top_parent, $asm->exclude ) ) ){
|
235 |
|
|
|
|
|
236 |
if( $asm->checked( 'css' ) ){
|
237 |
echo '<style type="text/css">';
|
238 |
+
include( Advanced_Sidebar_Menu::get_instance()->get_template_part( 'sidebar-menu.css' ) );
|
239 |
echo '</style>';
|
240 |
}
|
241 |
|
242 |
echo $args[ 'before_widget' ];
|
243 |
|
244 |
$content = '';
|
245 |
+
require( Advanced_Sidebar_Menu::get_instance()->get_template_part( 'page_list.php' ) );
|
246 |
echo apply_filters( 'advanced_sidebar_menu_page_widget_output', $content, $args, $instance );
|
247 |
echo $args[ 'after_widget' ];
|
248 |
|
256 |
*
|
257 |
* Get the children's ids of the top level parent
|
258 |
*
|
259 |
+
* @param Advanced_Sidebar_Menu_Menu $asm
|
260 |
+
* @param array $filter_args
|
261 |
*
|
262 |
* @filter advanced_sidebar_menu_child_pages
|
263 |
*
|
286 |
}
|
287 |
|
288 |
$filter_args[ 0 ] = $child_pages;
|
289 |
+
|
290 |
+
if( defined( 'ADVANCED_SIDEBAR_MENU_PRO_VERSION' ) ){
|
291 |
+
/**
|
292 |
+
* Pro version 1.4.3 or below had a typeset for the arg
|
293 |
+
* of this filter. This changed in version 6.0.0 so we have
|
294 |
+
* to disable the filter. If someone has an issue then make
|
295 |
+
* sure they update to version 1.4.4 to restore this filter
|
296 |
+
*/
|
297 |
+
if( version_compare( ADVANCED_SIDEBAR_MENU_PRO_VERSION, '1.4.4', '>=' ) ){
|
298 |
+
$child_pages = apply_filters_ref_array( 'advanced_sidebar_menu_child_pages', $filter_args );
|
299 |
+
}
|
300 |
+
|
301 |
+
} else {
|
302 |
+
$child_pages = apply_filters_ref_array( 'advanced_sidebar_menu_child_pages', $filter_args );
|
303 |
+
}
|
304 |
|
305 |
return $child_pages;
|
306 |
|
views/category_list.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* The
|
5 |
* @author Mat Lipe
|
6 |
* @since 4.3.1
|
7 |
*
|
@@ -11,6 +11,8 @@
|
|
11 |
* @param Do not edit this file in this location or it will break on update
|
12 |
*/
|
13 |
|
|
|
|
|
14 |
$content = '';
|
15 |
|
16 |
//Include the parent page if chosen
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* The Output of the Advanced Sidebar Categories Widget
|
5 |
* @author Mat Lipe
|
6 |
* @since 4.3.1
|
7 |
*
|
11 |
* @param Do not edit this file in this location or it will break on update
|
12 |
*/
|
13 |
|
14 |
+
/** @var Advanced_Sidebar_Menu_Menu $asm */
|
15 |
+
|
16 |
$content = '';
|
17 |
|
18 |
//Include the parent page if chosen
|
views/page_list.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
* @notice Do not edit this file in its original location or it will break on upgrade
|
12 |
*/
|
13 |
|
14 |
-
/** @var
|
15 |
$asm->title();
|
16 |
|
17 |
#-- list the parent page if chosen
|
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();
|
16 |
|
17 |
#-- list the parent page if chosen
|
widgets/init.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Registers the widgets
|
5 |
-
* @author Mat Lipe
|
6 |
-
* @since 4/13/12
|
7 |
-
* @package Advanced Sidebar Menu
|
8 |
-
*
|
9 |
-
*/
|
10 |
-
|
11 |
-
//The list of widgets
|
12 |
-
|
13 |
-
require( 'page.widget.php' );
|
14 |
-
require( 'category.widget.php' );
|
15 |
-
|
16 |
-
add_action( 'widgets_init', 'advanced_sidebar_menu_widgets' );
|
17 |
-
|
18 |
-
function advanced_sidebar_menu_widgets(){
|
19 |
-
|
20 |
-
register_widget( "advanced_sidebar_menu_page" );
|
21 |
-
register_widget( "advanced_sidebar_menu_category" );
|
22 |
-
|
23 |
-
}
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|