Advanced Sidebar Menu - Version 7.2.0

Version Description

Download this release

Release Info

Developer Mat Lipe
Plugin Icon 128x128 Advanced Sidebar Menu
Version 7.2.0
Comparing to
See all releases

Code changes from version 7.1.2 to 7.2.0

advanced-sidebar-menu.php CHANGED
@@ -4,7 +4,7 @@ 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: 7.1.2
8
Author URI: https://matlipe.com
9
Text Domain: advanced-sidebar-menu
10
*/
@@ -14,7 +14,7 @@ if ( defined( 'ADVANCED_SIDEBAR_BASIC_VERSION' ) ) {
14
return;
15
}
16
17
- define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '7.1.2' );
18
define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
19
20
if ( ! function_exists( 'advanced_sidebar_menu_load' ) ) {
@@ -38,6 +38,7 @@ if ( ! function_exists( 'advanced_sidebar_menu_load' ) ) {
38
function advanced_sidebar_menu_autoload( $class ) {
39
$classes = array(
40
//widgets
41
'Advanced_Sidebar_Menu_Widget_Page' => 'Widget/Page.php',
42
'Advanced_Sidebar_Menu_Widget_Category' => 'Widget/Category.php',
43
@@ -76,25 +77,81 @@ function advanced_sidebar_menu_script() {
76
array( 'jquery' ),
77
ADVANCED_SIDEBAR_BASIC_VERSION
78
);
79
}
80
81
- #-- Let know about new Pro Version
82
- add_action( 'advanced_sidebar_menu_after_widget_form', 'advanced_sidebar_menu_pro_notice' );
83
- function advanced_sidebar_menu_pro_notice() {
84
if ( defined( 'ADVANCED_SIDEBAR_MENU_PRO_VERSION' ) ) {
85
return;
86
}
87
?>
88
- <fieldset style="border: 1px solid black; border-radius: 10px; padding: 10px;">
89
- <legend style="font-size: 14px; font-weight: bold;">
90
- <?php esc_html_e( 'Checkout Advanced Sidebar Menu Pro!', 'advanced-sidebar-menu' ); ?>
91
- </legend>
92
<p>
93
<?php
94
- /* translators: {<a>}{</a>} links to https://matlipe.com/product/advanced-sidebar-menu-pro/ */
95
- printf( esc_html_x( 'Upgrade to %1$sAdvanced Sidebar Menu Pro%2$s for Priority Support, Styles, Custom Link Text, Accordions, Custom Post Types, and so much more!', '{<a>}{</a>}', 'advanced-sidebar-menu' ), '<a target="blank" href="https://matlipe.com/product/advanced-sidebar-menu-pro/">', '</a>' ); ?>
96
<p>
97
- </fieldset>
98
<?php
99
}
100
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: 7.2.0
8
Author URI: https://matlipe.com
9
Text Domain: advanced-sidebar-menu
10
*/
14
return;
15
}
16
17
+ define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '7.2.0' );
18
define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
19
20
if ( ! function_exists( 'advanced_sidebar_menu_load' ) ) {
38
function advanced_sidebar_menu_autoload( $class ) {
39
$classes = array(
40
//widgets
41
+ 'Advanced_Sidebar_Menu__Widget__Widget' => 'Widget/Widget.php',
42
'Advanced_Sidebar_Menu_Widget_Page' => 'Widget/Page.php',
43
'Advanced_Sidebar_Menu_Widget_Category' => 'Widget/Category.php',
44
77
array( 'jquery' ),
78
ADVANCED_SIDEBAR_BASIC_VERSION
79
);
80
+
81
+ wp_enqueue_style(
82
+ apply_filters( 'asm_style', 'advanced-sidebar-menu-style' ),
83
+ plugins_url( 'resources/css/advanced-sidebar-menu.css', __FILE__ ),
84
+ array(),
85
+ ADVANCED_SIDEBAR_BASIC_VERSION
86
+ );
87
}
88
89
+
90
+ add_action( 'advanced_sidebar_menu_after_widget_form', 'advanced_sidebar_menu_upgrade_notice', 1, 2 );
91
+ /**
92
+ * @todo translate these features
93
+ *
94
+ * @param array $instance
95
+ * @param WP_Widget $widget
96
+ *
97
+ * @return void
98
+ */
99
+ function advanced_sidebar_menu_upgrade_notice( array $instance, WP_Widget $widget ) {
100
if ( defined( 'ADVANCED_SIDEBAR_MENU_PRO_VERSION' ) ) {
101
return;
102
}
103
?>
104
+ <div class="advanced-sidebar-menu-column-box">
105
+ <h3><?php esc_html_e( 'Checkout Advanced Sidebar Menu Pro!', 'advanced-sidebar-menu' ); ?></h3>
106
<p>
107
+ <strong>
108
+ <?php
109
+ /* translators: {<a>}{</a>} links to https://matlipe.com/product/advanced-sidebar-menu-pro/ */
110
+ printf( esc_html_x( 'Upgrade to %1$sAdvanced Sidebar Menu Pro%2$s for these features:', '{<a>}{</a>}', 'advanced-sidebar-menu' ), '<a target="blank" href="https://matlipe.com/product/advanced-sidebar-menu-pro/">', '</a>' ); ?>
111
+ </strong>
112
+ <ol>
113
+ <li>Priority support.</li>
114
<?php
115
+ //page widget options
116
+ if ( 'advanced_sidebar_menu' === $widget->id_base ) {
117
+ ?>
118
+ <li>Ability to customize each page's link text.</li>
119
+ <li>Ability to exclude a page from all menus using a simple checkbox.</li>
120
+ <li>Number of levels of pages to show when always displayed child pages is not checked.</li>
121
+ <li>Ability to select and display custom post types.</li>
122
+ <li>Option to display the current page’s parents and grandparents only</li>
123
+ <li>Option to display child page siblings when on a child page. <strong> NEW</strong></li>
124
+ <li>Option to display child page siblings when on a child page with no grandchild pages.<strong>
125
+ NEW</strong></li>
126
+ <li>Accordion menu support for pages.</li>
127
+ <?php
128
+ //category widget options
129
+ } else {
130
+ ?>
131
+ <li>Link ordering for the category widget.</li>
132
+ <li>Ability to select and display custom taxonomies.</li>
133
+ <li>Accordion menu support for categories.</li>
134
+ <?php
135
+ }
136
+ ?>
137
+ <li>Accordion icon selection from 4 styles of icons.</li>
138
+ <li>Accordion icon color selection.</li>
139
+ <li>Accordion option to keep all sections closed until clicked.</li>
140
+ <li>Accordion option to include highest level parent in accordion.</li>
141
+ <li>Click and drag styling for both the page and category widgets.</li>
142
+ <li>Styling options for links including color, background color, size, and font weight.</li>
143
+ <li>Styling options for different levels of links.</li>
144
+ <li>Styling options for the current page or category.</li>
145
+ <li>Styling options for the parent of the current page or category.</li>
146
+ <li>Block styling options including borders and border colors.</li>
147
+ <li>Bullet style selection from 7 styles or select none to have no bullets.</li>
148
+ <li>Ability to display the widgets everywhere the sidebar display. <strong> NEW</strong></li>
149
+ <li>Ability to select the parent page/category when using the display widget everywhere option.<strong>
150
+ NEW</strong></li>
151
+ <li>Access to members only support area.</li>
152
+ </ol>
153
<p>
154
+ </div>
155
<?php
156
}
157
languages/advanced-sidebar-menu-de_DE.mo CHANGED
Binary file
languages/advanced-sidebar-menu-de_DE.po CHANGED
@@ -1,8 +1,8 @@
1
msgid ""
2
msgstr ""
3
"Project-Id-Version: Advanced Sidebar Menu\n"
4
- "POT-Creation-Date: 2018-01-09 09:48-0500\n"
5
- "PO-Revision-Date: 2018-01-09 09:48-0500\n"
6
"Last-Translator: Mat Lipe <mat@matlipe.com>\n"
7
"Language-Team: \n"
8
"Language: de\n"
@@ -10,7 +10,7 @@ msgstr ""
10
"Content-Type: text/plain; charset=UTF-8\n"
11
"Content-Transfer-Encoding: 8bit\n"
12
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
13
- "X-Generator: Poedit 2.0.5\n"
14
"X-Poedit-Basepath: ..\n"
15
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
16
"X-Poedit-WPHeader: advanced-sidebar-menu.php\n"
@@ -21,20 +21,16 @@ msgstr ""
21
"X-Poedit-SearchPath-0: .\n"
22
"X-Poedit-SearchPathExcluded-0: *.js\n"
23
24
- #: advanced-sidebar-menu.php:90
25
msgid "Checkout Advanced Sidebar Menu Pro!"
26
msgstr "Kasse Advanced Sidebar Menu Pro!"
27
28
#. translators: {<a>}{</a>} links to https://matlipe.com/product/advanced-sidebar-menu-pro/
29
- #: advanced-sidebar-menu.php:95
30
#, php-format
31
msgctxt "{<a>}{</a>}"
32
- msgid ""
33
- "Upgrade to %1$sAdvanced Sidebar Menu Pro%2$s for Priority Support, Styles, "
34
- "Custom Link Text, Accordions, Custom Post Types, and so much more!"
35
msgstr ""
36
- "Upgrade auf %1$sAdvanced Sidebar Menu Pro %2$s für Priority-Support, Styles, "
37
- "Custom-Link-Text, Akkordeons, Custom Post Types und vieles mehr!"
38
39
#: src/Widget/Category.php:42
40
msgid ""
@@ -47,50 +43,46 @@ msgstr ""
47
msgid "Advanced Sidebar Categories Menu"
48
msgstr "Advanced Sidebar Kategorien-Menü"
49
50
- #: src/Widget/Category.php:65 src/Widget/Page.php:65
51
msgid "Title"
52
msgstr "Titel"
53
54
- #: src/Widget/Category.php:72
55
- msgid "Display parent category"
56
- msgstr "Übergeordnete Kategorie anzeigen"
57
-
58
#: src/Widget/Category.php:79
59
msgid "Display menu when there is only the parent category"
60
msgstr "Menü \"Anzeige\" wird nur die übergeordnete Kategorie"
61
62
- #: src/Widget/Category.php:85
63
- msgid "Use this plugins styling"
64
- msgstr "Verwenden Sie dieses Plugins-styling"
65
66
- #: src/Widget/Category.php:91
67
msgid "Display categories on single posts"
68
msgstr "Kategorien auf einzelne Beiträge anzeigen"
69
70
- #: src/Widget/Category.php:104
71
msgid "Display each single post's category"
72
msgstr "Zeigen Sie die einzelnen Kategorien der einzelnen Posts an"
73
74
- #: src/Widget/Category.php:111 src/Widget/Category.php:120
75
msgid "In a new widget"
76
msgstr "In einem neuen Widget"
77
78
- #: src/Widget/Category.php:114 src/Widget/Category.php:123
79
msgid "In another list in the same widget"
80
msgstr "In einer anderen Liste im selben Widget"
81
82
- #: src/Widget/Category.php:134
83
msgid "Categories to exclude (ids), comma separated"
84
msgstr "Kategorien ausschließen (Ids), durch Kommata getrennt"
85
86
- #: src/Widget/Category.php:139
87
- msgid "Always display child categories"
88
- msgstr "Immer untergeordnete Kategorien anzeigen"
89
-
90
- #: src/Widget/Category.php:153 src/Widget/Page.php:131
91
- msgid "Levels to display"
92
- msgstr "Anzuzeigenden Ebenen"
93
-
94
#: src/Widget/Page.php:38
95
msgid "Creates a menu of all the pages using the child/parent relationship"
96
msgstr ""
@@ -101,30 +93,26 @@ msgstr ""
101
msgid "Advanced Sidebar Pages Menu"
102
msgstr "Advanced Sidebar Seitenmenü"
103
104
- #: src/Widget/Page.php:71
105
- msgid "Display parent page"
106
- msgstr "Zeigen Sie die übergeordnete Seite an"
107
108
- #: src/Widget/Page.php:78
109
msgid "Display menu when there is only the parent page"
110
msgstr "Menü \"Anzeige\" wird nur die übergeordnete Seite"
111
112
- #: src/Widget/Page.php:84
113
- msgid "Order By"
114
- msgstr "Sortieren nach"
115
116
- #: src/Widget/Page.php:103
117
- msgid "Use this Plugin's Styling"
118
- msgstr "Benutze das Plugin Styling"
119
120
- #: src/Widget/Page.php:109
121
msgid "Pages to exclude (ids), comma separated"
122
msgstr "Auszuschließende Seiten (IDs), durch Kommas getrennt"
123
124
- #: src/Widget/Page.php:114
125
- msgid "Always display child pages"
126
- msgstr "Immer untergeordnete Seiten anzeigen"
127
-
128
#. Plugin Name of the plugin/theme
129
msgid "Advanced Sidebar Menu"
130
msgstr "Advanced Sidebar Menu"
@@ -148,3 +136,17 @@ msgstr "Mat Lipe"
148
#. Author URI of the plugin/theme
149
msgid "https://matlipe.com"
150
msgstr "https://matlipe.com"
1
msgid ""
2
msgstr ""
3
"Project-Id-Version: Advanced Sidebar Menu\n"
4
+ "POT-Creation-Date: 2018-04-25 16:28-0400\n"
5
+ "PO-Revision-Date: 2018-04-25 16:29-0400\n"
6
"Last-Translator: Mat Lipe <mat@matlipe.com>\n"
7
"Language-Team: \n"
8
"Language: de\n"
10
"Content-Type: text/plain; charset=UTF-8\n"
11
"Content-Transfer-Encoding: 8bit\n"
12
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
13
+ "X-Generator: Poedit 2.0.7\n"
14
"X-Poedit-Basepath: ..\n"
15
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
16
"X-Poedit-WPHeader: advanced-sidebar-menu.php\n"
21
"X-Poedit-SearchPath-0: .\n"
22
"X-Poedit-SearchPathExcluded-0: *.js\n"
23
24
+ #: advanced-sidebar-menu.php:105
25
msgid "Checkout Advanced Sidebar Menu Pro!"
26
msgstr "Kasse Advanced Sidebar Menu Pro!"
27
28
#. translators: {<a>}{</a>} links to https://matlipe.com/product/advanced-sidebar-menu-pro/
29
+ #: advanced-sidebar-menu.php:110
30
#, php-format
31
msgctxt "{<a>}{</a>}"
32
+ msgid "Upgrade to %1$sAdvanced Sidebar Menu Pro%2$s for these features:"
33
msgstr ""
34
35
#: src/Widget/Category.php:42
36
msgid ""
43
msgid "Advanced Sidebar Categories Menu"
44
msgstr "Advanced Sidebar Kategorien-Menü"
45
46
+ #: src/Widget/Category.php:64 src/Widget/Page.php:67
47
msgid "Title"
48
msgstr "Titel"
49
50
#: src/Widget/Category.php:79
51
+ msgid "Display highest level parent category"
52
+ msgstr "Anzeige der übergeordneten Kategorie der höchsten Ebene"
53
+
54
+ #: src/Widget/Category.php:87
55
msgid "Display menu when there is only the parent category"
56
msgstr "Menü \"Anzeige\" wird nur die übergeordnete Kategorie"
57
58
+ #: src/Widget/Category.php:94
59
+ msgid "Always display child categories"
60
+ msgstr "Immer untergeordnete Kategorien anzeigen"
61
+
62
+ #: src/Widget/Category.php:102 src/Widget/Page.php:106
63
+ msgid "Levels to display"
64
+ msgstr "Anzuzeigenden Ebenen"
65
66
+ #: src/Widget/Category.php:128
67
msgid "Display categories on single posts"
68
msgstr "Kategorien auf einzelne Beiträge anzeigen"
69
70
+ #: src/Widget/Category.php:135
71
msgid "Display each single post's category"
72
msgstr "Zeigen Sie die einzelnen Kategorien der einzelnen Posts an"
73
74
+ #: src/Widget/Category.php:141
75
msgid "In a new widget"
76
msgstr "In einem neuen Widget"
77
78
+ #: src/Widget/Category.php:144
79
msgid "In another list in the same widget"
80
msgstr "In einer anderen Liste im selben Widget"
81
82
+ #: src/Widget/Category.php:157
83
msgid "Categories to exclude (ids), comma separated"
84
msgstr "Kategorien ausschließen (Ids), durch Kommata getrennt"
85
86
#: src/Widget/Page.php:38
87
msgid "Creates a menu of all the pages using the child/parent relationship"
88
msgstr ""
93
msgid "Advanced Sidebar Pages Menu"
94
msgstr "Advanced Sidebar Seitenmenü"
95
96
+ #: src/Widget/Page.php:82
97
+ msgid "Display highest level parent page"
98
+ msgstr "Zeigt die oberste Seite der obersten Ebene an"
99
100
+ #: src/Widget/Page.php:90
101
msgid "Display menu when there is only the parent page"
102
msgstr "Menü \"Anzeige\" wird nur die übergeordnete Seite"
103
104
+ #: src/Widget/Page.php:97
105
+ msgid "Always display child pages"
106
+ msgstr "Immer untergeordnete Seiten anzeigen"
107
108
+ #: src/Widget/Page.php:130
109
+ msgid "Order by"
110
+ msgstr "Sortieren nach"
111
112
+ #: src/Widget/Page.php:154
113
msgid "Pages to exclude (ids), comma separated"
114
msgstr "Auszuschließende Seiten (IDs), durch Kommas getrennt"
115
116
#. Plugin Name of the plugin/theme
117
msgid "Advanced Sidebar Menu"
118
msgstr "Advanced Sidebar Menu"
136
#. Author URI of the plugin/theme
137
msgid "https://matlipe.com"
138
msgstr "https://matlipe.com"
139
+
140
+ #~ msgctxt "{<a>}{</a>}"
141
+ #~ msgid ""
142
+ #~ "Upgrade to %1$sAdvanced Sidebar Menu Pro%2$s for Priority Support, "
143
+ #~ "Styles, Custom Link Text, Accordions, Custom Post Types, and so much more!"
144
+ #~ msgstr ""
145
+ #~ "Upgrade auf %1$sAdvanced Sidebar Menu Pro %2$s für Priority-Support, "
146
+ #~ "Styles, Custom-Link-Text, Akkordeons, Custom Post Types und vieles mehr!"
147
+
148
+ #~ msgid "Use this plugins styling"
149
+ #~ msgstr "Verwenden Sie dieses Plugins-styling"
150
+
151
+ #~ msgid "Use this Plugin's Styling"
152
+ #~ msgstr "Benutze das Plugin Styling"
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: 2018-01-09 09:48-0500\n"
7
"PO-Revision-Date: 2018-01-09 07:14-0500\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 2.0.5\n"
14
"X-Poedit-Basepath: ..\n"
15
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
16
"X-Poedit-WPHeader: advanced-sidebar-menu.php\n"
@@ -21,17 +21,15 @@ msgstr ""
21
"X-Poedit-SearchPath-0: .\n"
22
"X-Poedit-SearchPathExcluded-0: *.js\n"
23
24
- #: advanced-sidebar-menu.php:90
25
msgid "Checkout Advanced Sidebar Menu Pro!"
26
msgstr ""
27
28
#. translators: {<a>}{</a>} links to https://matlipe.com/product/advanced-sidebar-menu-pro/
29
- #: advanced-sidebar-menu.php:95
30
#, php-format
31
msgctxt "{<a>}{</a>}"
32
- msgid ""
33
- "Upgrade to %1$sAdvanced Sidebar Menu Pro%2$s for Priority Support, Styles, "
34
- "Custom Link Text, Accordions, Custom Post Types, and so much more!"
35
msgstr ""
36
37
#: src/Widget/Category.php:42
@@ -43,50 +41,46 @@ msgstr ""
43
msgid "Advanced Sidebar Categories Menu"
44
msgstr ""
45
46
- #: src/Widget/Category.php:65 src/Widget/Page.php:65
47
msgid "Title"
48
msgstr ""
49
50
- #: src/Widget/Category.php:72
51
- msgid "Display parent category"
52
msgstr ""
53
54
- #: src/Widget/Category.php:79
55
msgid "Display menu when there is only the parent category"
56
msgstr ""
57
58
- #: src/Widget/Category.php:85
59
- msgid "Use this plugins styling"
60
msgstr ""
61
62
- #: src/Widget/Category.php:91
63
msgid "Display categories on single posts"
64
msgstr ""
65
66
- #: src/Widget/Category.php:104
67
msgid "Display each single post's category"
68
msgstr ""
69
70
- #: src/Widget/Category.php:111 src/Widget/Category.php:120
71
msgid "In a new widget"
72
msgstr ""
73
74
- #: src/Widget/Category.php:114 src/Widget/Category.php:123
75
msgid "In another list in the same widget"
76
msgstr ""
77
78
- #: src/Widget/Category.php:134
79
msgid "Categories to exclude (ids), comma separated"
80
msgstr ""
81
82
- #: src/Widget/Category.php:139
83
- msgid "Always display child categories"
84
- msgstr ""
85
-
86
- #: src/Widget/Category.php:153 src/Widget/Page.php:131
87
- msgid "Levels to display"
88
- msgstr ""
89
-
90
#: src/Widget/Page.php:38
91
msgid "Creates a menu of all the pages using the child/parent relationship"
92
msgstr ""
@@ -95,30 +89,26 @@ msgstr ""
95
msgid "Advanced Sidebar Pages Menu"
96
msgstr ""
97
98
- #: src/Widget/Page.php:71
99
- msgid "Display parent page"
100
msgstr ""
101
102
- #: src/Widget/Page.php:78
103
msgid "Display menu when there is only the parent page"
104
msgstr ""
105
106
- #: src/Widget/Page.php:84
107
- msgid "Order By"
108
msgstr ""
109
110
- #: src/Widget/Page.php:103
111
- msgid "Use this Plugin's Styling"
112
msgstr ""
113
114
- #: src/Widget/Page.php:109
115
msgid "Pages to exclude (ids), comma separated"
116
msgstr ""
117
118
- #: src/Widget/Page.php:114
119
- msgid "Always display child pages"
120
- msgstr ""
121
-
122
#. Plugin Name of the plugin/theme
123
msgid "Advanced Sidebar Menu"
124
msgstr ""
3
msgstr ""
4
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
"Project-Id-Version: Advanced Sidebar Menu\n"
6
+ "POT-Creation-Date: 2018-04-25 16:28-0400\n"
7
"PO-Revision-Date: 2018-01-09 07:14-0500\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 2.0.7\n"
14
"X-Poedit-Basepath: ..\n"
15
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
16
"X-Poedit-WPHeader: advanced-sidebar-menu.php\n"
21
"X-Poedit-SearchPath-0: .\n"
22
"X-Poedit-SearchPathExcluded-0: *.js\n"
23
24
+ #: advanced-sidebar-menu.php:105
25
msgid "Checkout Advanced Sidebar Menu Pro!"
26
msgstr ""
27
28
#. translators: {<a>}{</a>} links to https://matlipe.com/product/advanced-sidebar-menu-pro/
29
+ #: advanced-sidebar-menu.php:110
30
#, php-format
31
msgctxt "{<a>}{</a>}"
32
+ msgid "Upgrade to %1$sAdvanced Sidebar Menu Pro%2$s for these features:"
33
msgstr ""
34
35
#: src/Widget/Category.php:42
41
msgid "Advanced Sidebar Categories Menu"
42
msgstr ""
43
44
+ #: src/Widget/Category.php:64 src/Widget/Page.php:67
45
msgid "Title"
46
msgstr ""
47
48
+ #: src/Widget/Category.php:79
49
+ msgid "Display highest level parent category"
50
msgstr ""
51
52
+ #: src/Widget/Category.php:87
53
msgid "Display menu when there is only the parent category"
54
msgstr ""
55
56
+ #: src/Widget/Category.php:94
57
+ msgid "Always display child categories"
58
msgstr ""
59
60
+ #: src/Widget/Category.php:102 src/Widget/Page.php:106
61
+ msgid "Levels to display"
62
+ msgstr ""
63
+
64
+ #: src/Widget/Category.php:128
65
msgid "Display categories on single posts"
66
msgstr ""
67
68
+ #: src/Widget/Category.php:135
69
msgid "Display each single post's category"
70
msgstr ""
71
72
+ #: src/Widget/Category.php:141
73
msgid "In a new widget"
74
msgstr ""
75
76
+ #: src/Widget/Category.php:144
77
msgid "In another list in the same widget"
78
msgstr ""
79
80
+ #: src/Widget/Category.php:157
81
msgid "Categories to exclude (ids), comma separated"
82
msgstr ""
83
84
#: src/Widget/Page.php:38
85
msgid "Creates a menu of all the pages using the child/parent relationship"
86
msgstr ""
89
msgid "Advanced Sidebar Pages Menu"
90
msgstr ""
91
92
+ #: src/Widget/Page.php:82
93
+ msgid "Display highest level parent page"
94
msgstr ""
95
96
+ #: src/Widget/Page.php:90
97
msgid "Display menu when there is only the parent page"
98
msgstr ""
99
100
+ #: src/Widget/Page.php:97
101
+ msgid "Always display child pages"
102
msgstr ""
103
104
+ #: src/Widget/Page.php:130
105
+ msgid "Order by"
106
msgstr ""
107
108
+ #: src/Widget/Page.php:154
109
msgid "Pages to exclude (ids), comma separated"
110
msgstr ""
111
112
#. Plugin Name of the plugin/theme
113
msgid "Advanced Sidebar Menu"
114
msgstr ""
readme.txt CHANGED
@@ -4,9 +4,9 @@ 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&currency_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.6.0
7
- Tested up to: 4.9.4
8
Requires PHP: 5.2.4
9
- Stable tag: 7.1.2
10
11
== Description ==
12
@@ -34,7 +34,6 @@ Keeps the menu clean and usable. Only related items display so you don't have to
34
* Display highest level parent page
35
* Display menu when there is only the parent page
36
* Order pages by (date, title, page order)
37
- * Use built in styling (very plain styling, for more advanced styling <a href="https://matlipe.com/product/advanced-sidebar-menu-pro/" target="_blank">Go Pro!</a>)
38
* Exclude pages
39
* Always display child Pages
40
* Number of levels of child pages to display when always display child pages is checked
@@ -43,7 +42,6 @@ Keeps the menu clean and usable. Only related items display so you don't have to
43
* Add a title to the widget
44
* Display highest level parent category
45
* Display menu when there is only the parent category
46
- * Use built in styling (very plain styling, for more advanced styling <a href="https://matlipe.com/product/advanced-sidebar-menu-pro/" target="_blank">Go Pro!</a>)
47
* Display categories on single posts
48
* Display each single post's category in a new widget or in same list
49
* Exclude categories
@@ -52,7 +50,7 @@ Keeps the menu clean and usable. Only related items display so you don't have to
52
53
<h4>Pro Features</h4>
54
* Priority support.
55
- * Ability to customize each page link�s text.
56
* Number of levels of pages to show when always displayed child pages is not checked.
57
* Click and drag styling for both the page and category widgets.
58
* Styling options for links including color, background color, size, and font weight.
@@ -71,11 +69,11 @@ Keeps the menu clean and usable. Only related items display so you don't have to
71
* Link ordering for the category widget.
72
* Ability to select and display custom post types.
73
* Ability to select and display custom taxonomies.
74
- * Option to display the current page's parents and grandparents only
75
- * Option to display child page siblings when on a child page **NEW**
76
- * Option to display child page siblings when on a child page with no grandchild pages **NEW**
77
- * Ability to display the widgets everywhere the sidebar display **NEW**
78
- * Ability to select the parent page/category when using the display widget everywhere option **NEW**
79
* Access to members only support area.
80
81
<h4>Currently ships with the following languages</h4>
@@ -147,6 +145,9 @@ Yes. Based on whatever page, post, or category you are on, the menu will change
147
148
149
== Changelog ==
150
= 7.1.0 =
151
* Support Pro Version 3.0.0
152
* Add German translations
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&currency_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.6.0
7
+ Tested up to: 4.9.6
8
Requires PHP: 5.2.4
9
+ Stable tag: 7.2.0
10
11
== Description ==
12
34
* Display highest level parent page
35
* Display menu when there is only the parent page
36
* Order pages by (date, title, page order)
37
* Exclude pages
38
* Always display child Pages
39
* Number of levels of child pages to display when always display child pages is checked
42
* Add a title to the widget
43
* Display highest level parent category
44
* Display menu when there is only the parent category
45
* Display categories on single posts
46
* Display each single post's category in a new widget or in same list
47
* Exclude categories
50
51
<h4>Pro Features</h4>
52
* Priority support.
53
+ * Ability to customize each page's link text.
54
* Number of levels of pages to show when always displayed child pages is not checked.
55
* Click and drag styling for both the page and category widgets.
56
* Styling options for links including color, background color, size, and font weight.
69
* Link ordering for the category widget.
70
* Ability to select and display custom post types.
71
* Ability to select and display custom taxonomies.
72
+ * Option to display the current page's parents and grandparents only.
73
+ * Option to display child page siblings when on a child page. **NEW**
74
+ * Option to display child page siblings when on a child page with no grandchild pages. **NEW**
75
+ * Ability to display the widgets everywhere the sidebar display. **NEW**
76
+ * Ability to select the parent page/category when using the display widget everywhere option. **NEW**
77
* Access to members only support area.
78
79
<h4>Currently ships with the following languages</h4>
145
146
147
== Changelog ==
148
+ = 7.2.0
149
+ * New improved widget structure
150
+
151
= 7.1.0 =
152
* Support Pro Version 3.0.0
153
* Add German translations
resources/css/advanced-sidebar-menu.css ADDED
@@ -0,0 +1,21 @@
1
+ .advanced-sidebar-menu-column {
2
+ float: left;
3
+ width: 49%;
4
+ }
5
+
6
+ .advanced-sidebar-menu-column-right {
7
+ margin-left: 2%;
8
+ }
9
+
10
+ .advanced-sidebar-menu-column-box {
11
+ margin-bottom: 10px;
12
+ padding: 10px;
13
+ border: 1px solid #ddd;
14
+ background: #f1f1f1;
15
+ }
16
+
17
+ @media all and ( max-width: 620px ) {
18
+ .advanced-sidebar-menu-column {
19
+ width: 100%;
20
+ }
21
+ }
resources/js/advanced-sidebar-menu.js CHANGED
@@ -4,20 +4,15 @@
4
* Use the id or inline tags for this
5
*
6
**/
7
- function asm_reveal_element( this_element_id ){
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
-
4
* Use the id or inline tags for this
5
*
6
**/
7
+ function asm_reveal_element(this_element_id) {
8
+ //old used ids. New use data-js so multiple may be used specifically
9
+ //@todo remove this select of id once PRO has been converted over
10
+ var el = jQuery( '[id="' + this_element_id + '"]:first');
11
+ console.info( el.length );
12
+ if( ! el.length ){
13
+ el = jQuery( '[data-js="' + this_element_id + '"]' );
14
}
15
+ el.toggle();
16
+ var status = el.is(':visible') ? 'show' : 'hide';
17
+ jQuery( document ).trigger('advanced-sidebar-menu/reveal-element', [this_element_id, status]);
18
}
src/Core.php CHANGED
@@ -10,31 +10,17 @@
10
*/
11
class Advanced_Sidebar_Menu_Core {
12
13
- protected function hook(){
14
add_action( 'widgets_init', array( $this, 'register_widgets' ) );
15
}
16
17
18
- public function register_widgets(){
19
register_widget( 'Advanced_Sidebar_Menu_Widget_Page' );
20
register_widget( 'Advanced_Sidebar_Menu_Widget_Category' );
21
}
22
23
24
- /**
25
- * The plugin styles are universal
26
- * This ensures that we only include them once on a single request
27
- *
28
- * @return void
29
- */
30
- public function include_plugin_styles() {
31
- ?>
32
- <style>
33
- <?php include_once $this->get_template_part( 'sidebar-menu.css' ); ?>
34
- </style>
35
- <?php
36
- }
37
-
38
/**
39
* Retrieve a template file from either the theme's 'advanced-sidebar-menu' directory
40
* or this plugins views folder if one does not exist
@@ -45,9 +31,9 @@ class Advanced_Sidebar_Menu_Core {
45
*
46
* @return string
47
*/
48
- public function get_template_part( $file_name ){
49
$file = locate_template( 'advanced-sidebar-menu/' . $file_name );
50
- if( empty( $file ) ){
51
$file = ADVANCED_SIDEBAR_DIR . 'views/' . $file_name;
52
}
53
@@ -56,8 +42,19 @@ class Advanced_Sidebar_Menu_Core {
56
return $file;
57
}
58
59
//********** SINGLETON FUNCTIONS **********/
60
61
/**
62
* Instance of this class for use as singleton
63
*/
@@ -70,7 +67,7 @@ class Advanced_Sidebar_Menu_Core {
70
* @static
71
* @return void
72
*/
73
- public static function init(){
74
self::instance()->hook();
75
}
76
@@ -82,11 +79,11 @@ class Advanced_Sidebar_Menu_Core {
82
* @static
83
* @return self
84
*/
85
- public static function instance(){
86
- if( !is_a( self::$instance, __CLASS__ ) ){
87
self::$instance = new self();
88
}
89
90
return self::$instance;
91
}
92
- }
10
*/
11
class Advanced_Sidebar_Menu_Core {
12
13
+ protected function hook() {
14
add_action( 'widgets_init', array( $this, 'register_widgets' ) );
15
}
16
17
18
+ public function register_widgets() {
19
register_widget( 'Advanced_Sidebar_Menu_Widget_Page' );
20
register_widget( 'Advanced_Sidebar_Menu_Widget_Category' );
21
}
22
23
24
/**
25
* Retrieve a template file from either the theme's 'advanced-sidebar-menu' directory
26
* or this plugins views folder if one does not exist
31
*
32
* @return string
33
*/
34
+ public function get_template_part( $file_name ) {
35
$file = locate_template( 'advanced-sidebar-menu/' . $file_name );
36
+ if ( empty( $file ) ) {
37
$file = ADVANCED_SIDEBAR_DIR . 'views/' . $file_name;
38
}
39
42
return $file;
43
}
44
45
+
46
+ /**
47
+ * @deprecated
48
+ */
49
+ public function include_plugin_styles() {
50
+ _deprecated_function( 'Advanced_Sidebar_Menu_Core', '7.2.0' );
51
+ }
52
+
53
+
54
+
55
//********** SINGLETON FUNCTIONS **********/
56
57
+
58
/**
59
* Instance of this class for use as singleton
60
*/
67
* @static
68
* @return void
69
*/
70
+ public static function init() {
71
self::instance()->hook();
72
}
73
79
* @static
80
* @return self
81
*/
82
+ public static function instance() {
83
+ if ( ! is_a( self::$instance, __CLASS__ ) ) {
84
self::$instance = new self();
85
}
86
87
return self::$instance;
88
}
89
+ }
src/List_Pages.php CHANGED
@@ -258,7 +258,9 @@ class Advanced_Sidebar_Menu_List_Pages {
258
if ( ! $this->args['echo'] ) {
259
return $this->output;
260
}
261
echo $this->output;
262
}
263
264
258
if ( ! $this->args['echo'] ) {
259
return $this->output;
260
}
261
+ // phpcs:disable WordPress.XSS.EscapeOutput.OutputNotEscaped
262
echo $this->output;
263
+ // phpcs:enable
264
}
265
266
src/Menus/Abstract.php CHANGED
@@ -8,15 +8,15 @@
8
*/
9
abstract class Advanced_Sidebar_Menu_Menus_Abstract {
10
// keys available in both widgets.
11
- const TITLE = 'title';
12
- const INCLUDE_PARENT = 'include_parent';
13
const INCLUDE_CHILDLESS_PARENT = 'include_childless_parent';
14
- const ORDER = 'order';
15
- const ORDER_BY = 'order_by';
16
- const USE_PLUGIN_STYLES = 'css';
17
- const EXCLUDE = 'exclude';
18
- const DISPLAY_ALL = 'display_all';
19
- const LEVELS = 'levels';
20
21
/**
22
* args
@@ -85,18 +85,25 @@ abstract class Advanced_Sidebar_Menu_Menus_Abstract {
85
$this->args = $widget_args;
86
}
87
88
abstract public function get_top_parent_id();
89
90
abstract public function get_order_by();
91
92
abstract public function get_order();
93
94
abstract public function render();
95
96
abstract public function is_displayed();
97
98
abstract public function get_levels_to_display();
99
100
abstract public function get_menu_depth();
101
102
@@ -122,6 +129,7 @@ abstract class Advanced_Sidebar_Menu_Menus_Abstract {
122
return $this->instance;
123
}
124
125
/**
126
* The widget arguments from the current widget
127
*
@@ -162,11 +170,7 @@ abstract class Advanced_Sidebar_Menu_Menus_Abstract {
162
* @return bool
163
*/
164
public function include_parent() {
165
- if ( $this->checked( self::INCLUDE_PARENT ) && ! $this->is_excluded( $this->get_top_parent_id() ) ) {
166
- return true;
167
- }
168
-
169
- return false;
170
}
171
172
@@ -192,6 +196,7 @@ abstract class Advanced_Sidebar_Menu_Menus_Abstract {
192
public function get_excluded_ids() {
193
$excluded = explode( ',', $this->instance[ self::EXCLUDE ] );
194
$excluded = array_filter( $excluded );
195
$excluded = array_map( 'intval', $excluded );
196
197
return $excluded;
@@ -208,7 +213,9 @@ abstract class Advanced_Sidebar_Menu_Menus_Abstract {
208
$title = apply_filters( 'widget_title', $this->instance[ self::TITLE ], $this->args, $this->instance );
209
$title = apply_filters( 'advanced_sidebar_menu_widget_title', esc_html( $title ), $this->args, $this->instance, $this );
210
211
echo $this->args['before_title'] . $title . $this->args['after_title'];
212
}
213
}
214
@@ -252,6 +259,7 @@ abstract class Advanced_Sidebar_Menu_Menus_Abstract {
252
public static function _factory( $class, array $widget_instance, array $widget_args ) {
253
$menu = new $class( $widget_instance, $widget_args );
254
self::$current = $menu;
255
return $menu;
256
}
257
}
8
*/
9
abstract class Advanced_Sidebar_Menu_Menus_Abstract {
10
// keys available in both widgets.
11
+ const TITLE = 'title';
12
+ const INCLUDE_PARENT = 'include_parent';
13
const INCLUDE_CHILDLESS_PARENT = 'include_childless_parent';
14
+ const ORDER = 'order';
15
+ const ORDER_BY = 'order_by';
16
+ const USE_PLUGIN_STYLES = 'css';
17
+ const EXCLUDE = 'exclude';
18
+ const DISPLAY_ALL = 'display_all';
19
+ const LEVELS = 'levels';
20
21
/**
22
* args
85
$this->args = $widget_args;
86
}
87
88
+
89
abstract public function get_top_parent_id();
90
91
+
92
abstract public function get_order_by();
93
94
+
95
abstract public function get_order();
96
97
+
98
abstract public function render();
99
100
+
101
abstract public function is_displayed();
102
103
+
104
abstract public function get_levels_to_display();
105
106
+
107
abstract public function get_menu_depth();
108
109
129
return $this->instance;
130
}
131
132
+
133
/**
134
* The widget arguments from the current widget
135
*
170
* @return bool
171
*/
172
public function include_parent() {
173
+ return $this->checked( self::INCLUDE_PARENT ) && ! $this->is_excluded( $this->get_top_parent_id() );
174
}
175
176
196
public function get_excluded_ids() {
197
$excluded = explode( ',', $this->instance[ self::EXCLUDE ] );
198
$excluded = array_filter( $excluded );
199
+ $excluded = array_filter( $excluded, 'is_numeric' );
200
$excluded = array_map( 'intval', $excluded );
201
202
return $excluded;
213
$title = apply_filters( 'widget_title', $this->instance[ self::TITLE ], $this->args, $this->instance );
214
$title = apply_filters( 'advanced_sidebar_menu_widget_title', esc_html( $title ), $this->args, $this->instance, $this );
215
216
+ // phpcs:disable
217
echo $this->args['before_title'] . $title . $this->args['after_title'];
218
+ // phpcs:enable
219
}
220
}
221
259
public static function _factory( $class, array $widget_instance, array $widget_args ) {
260
$menu = new $class( $widget_instance, $widget_args );
261
self::$current = $menu;
262
+
263
return $menu;
264
}
265
}
src/Menus/Category.php CHANGED
@@ -452,6 +452,7 @@ class Advanced_Sidebar_Menu_Menus_Category extends Advanced_Sidebar_Menu_Menus_A
452
* @return void
453
*/
454
public function render() {
455
if ( ! $this->is_displayed() ) {
456
return;
457
}
@@ -461,14 +462,12 @@ class Advanced_Sidebar_Menu_Menus_Category extends Advanced_Sidebar_Menu_Menus_A
461
462
foreach ( $this->get_top_level_terms() as $_cat ) {
463
$this->set_current_top_level_term( $_cat );
464
- //@deprecated 7.0.0 variable name
465
- $all_categories = $this->get_child_terms();
466
- if ( ! $this->is_term_displayed( $all_categories ) ) {
467
continue;
468
}
469
470
if ( ! $menu_open || ( 'widget' === $this->instance[ self::EACH_CATEGORY_DISPLAY ] ) ) {
471
- //Start the menu
472
echo $this->args['before_widget'];
473
474
do_action( 'advanced-sidebar-menu/menus/category/render', $this );
@@ -476,9 +475,6 @@ class Advanced_Sidebar_Menu_Menus_Category extends Advanced_Sidebar_Menu_Menus_A
476
if ( ! $menu_open ) {
477
//must remain in the loop vs the template
478
$this->title();
479
- if ( $this->checked( self::USE_PLUGIN_STYLES ) ) {
480
- Advanced_Sidebar_Menu_Core::instance()->include_plugin_styles();
481
- }
482
483
$menu_open = true;
484
$close_menu = true;
@@ -500,6 +496,7 @@ class Advanced_Sidebar_Menu_Menus_Category extends Advanced_Sidebar_Menu_Menus_A
500
if ( ! $close_menu && $menu_open ) {
501
echo $this->args['after_widget'];
502
}
503
504
}
505
452
* @return void
453
*/
454
public function render() {
455
+ // phpcs:disable WordPress.XSS.EscapeOutput.OutputNotEscaped
456
if ( ! $this->is_displayed() ) {
457
return;
458
}
462
463
foreach ( $this->get_top_level_terms() as $_cat ) {
464
$this->set_current_top_level_term( $_cat );
465
+ if ( ! $this->is_term_displayed( $this->get_child_terms() ) ) {
466
continue;
467
}
468
469
if ( ! $menu_open || ( 'widget' === $this->instance[ self::EACH_CATEGORY_DISPLAY ] ) ) {
470
+ //phpcs
471
echo $this->args['before_widget'];
472
473
do_action( 'advanced-sidebar-menu/menus/category/render', $this );
475
if ( ! $menu_open ) {
476
//must remain in the loop vs the template
477
$this->title();
478
479
$menu_open = true;
480
$close_menu = true;
496
if ( ! $close_menu && $menu_open ) {
497
echo $this->args['after_widget'];
498
}
499
+ // phpcs:enable WordPress.XSS.EscapeOutput.OutputNotEscaped
500
501
}
502
src/Menus/Page.php CHANGED
@@ -168,15 +168,11 @@ class Advanced_Sidebar_Menu_Menus_Page extends Advanced_Sidebar_Menu_Menus_Abstr
168
return;
169
}
170
171
- // phpcs:disable
172
echo $this->args['before_widget'];
173
174
do_action( 'advanced-sidebar-menu/menus/page/render', $this );
175
176
- if ( $this->checked( self::USE_PLUGIN_STYLES ) ) {
177
- Advanced_Sidebar_Menu_Core::instance()->include_plugin_styles();
178
- }
179
-
180
$output = require Advanced_Sidebar_Menu_Core::instance()->get_template_part( 'page_list.php' );
181
echo apply_filters( 'advanced_sidebar_menu_page_widget_output', $output, $this->get_current_post(), $this->args, $this->instance, $this );
182
168
return;
169
}
170
171
+ // phpcs:disable WordPress.XSS.EscapeOutput.OutputNotEscaped
172
echo $this->args['before_widget'];
173
174
do_action( 'advanced-sidebar-menu/menus/page/render', $this );
175
176
$output = require Advanced_Sidebar_Menu_Core::instance()->get_template_part( 'page_list.php' );
177
echo apply_filters( 'advanced_sidebar_menu_page_widget_output', $output, $this->get_current_post(), $this->args, $this->instance, $this );
178
src/Widget/Category.php CHANGED
@@ -10,7 +10,7 @@
10
*
11
*
12
*/
13
- class Advanced_Sidebar_Menu_Widget_Category extends WP_Widget {
14
const TITLE = Advanced_Sidebar_Menu_Menus_Abstract::TITLE;
15
const INCLUDE_PARENT = Advanced_Sidebar_Menu_Menus_Abstract::INCLUDE_PARENT;
16
const INCLUDE_CHILDLESS_PARENT = Advanced_Sidebar_Menu_Menus_Abstract::INCLUDE_CHILDLESS_PARENT;
@@ -37,155 +37,172 @@ class Advanced_Sidebar_Menu_Widget_Category extends WP_Widget {
37
38
39
public function __construct() {
40
- $widget_ops = array(
41
'classname' => 'advanced-sidebar-menu advanced-sidebar-category',
42
'description' => __( 'Creates a menu of all the categories using the child/parent relationship', 'advanced-sidebar-menu' ),
43
);
44
- $control_ops = array( 'width' => 290 );
45
46
parent::__construct( 'advanced_sidebar_menu_category', __( 'Advanced Sidebar Categories Menu', 'advanced-sidebar-menu' ), $widget_ops, $control_ops );
47
}
48
49
50
/**
51
- * Creates a form for the Widget Options
52
*
53
- * @since 1.7.14
54
*
55
* @param array $instance
56
*
57
- * @actions do_action('advanced_sidebar_menu_category_widget_form', $instance );
58
* @return void
59
*/
60
public function form( $instance ) {
61
-
62
- $instance = wp_parse_args( $instance, self::$defaults );
63
-
64
?>
65
- <p> <?php _e( 'Title', 'advanced-sidebar-menu' ); ?>
66
- <br>
67
- <input id="<?php echo $this->get_field_name( self::TITLE ); ?>"
68
- name="<?php echo $this->get_field_name( self::TITLE ); ?>" class="widefat" type="text" value="<?php echo $instance[ self::TITLE ]; ?>"/>
69
- </p>
70
-
71
-
72
- <p> <?php _e( 'Display highest level parent category', 'advanced-sidebar-menu' ); ?>
73
- <input id="<?php echo $this->get_field_name( self::INCLUDE_PARENT ); ?>"
74
- name="<?php echo $this->get_field_name( self::INCLUDE_PARENT ); ?>" type="checkbox" value="checked"
75
- <?php echo $instance[ self::INCLUDE_PARENT ]; ?>/>
76
- </p>
77
-
78
-
79
- <p> <?php _e( 'Display menu when there is only the parent category', 'advanced-sidebar-menu' ); ?>
80
- <input id="<?php echo $this->get_field_name( self::INCLUDE_CHILDLESS_PARENT ); ?>"
81
- name="<?php echo $this->get_field_name( self::INCLUDE_CHILDLESS_PARENT ); ?>" type="checkbox" value="checked"
82
- <?php echo $instance[ self::INCLUDE_CHILDLESS_PARENT ]; ?>/>
83
- </p>
84
-
85
- <p> <?php _e( "Use this plugin's default styling", 'advanced-sidebar-menu' ); ?>
86
- <input id="<?php echo $this->get_field_name( self::USE_PLUGIN_STYLES ); ?>"
87
- name="<?php echo $this->get_field_name( self::USE_PLUGIN_STYLES ); ?>" type="checkbox" value="checked"
88
- <?php echo $instance[ self::USE_PLUGIN_STYLES ]; ?>/>
89
- </p>
90
-
91
- <p> <?php _e( 'Display categories on single posts', 'advanced-sidebar-menu' ); ?>
92
- <input id="<?php echo $this->get_field_name( self::DISPLAY_ON_SINGLE ); ?>"
93
- name="<?php echo $this->get_field_name( self::DISPLAY_ON_SINGLE ); ?>" type="checkbox" value="checked"
94
- onclick="javascript:asm_reveal_element( 'new-widget-<?php echo $this->get_field_name( self::EACH_CATEGORY_DISPLAY ); ?>' )"
95
- <?php echo $instance[ self::DISPLAY_ON_SINGLE ]; ?>/>
96
- </p>
97
-
98
- <span id="new-widget-<?php echo $this->get_field_name( self::EACH_CATEGORY_DISPLAY ); ?>" style="<?php
99
- if( $instance[ self::DISPLAY_ON_SINGLE ] === 'checked' ){
100
- echo 'display:block';
101
- } else {
102
- echo 'display:none';
103
- } ?>">
104
- <p><?php _e( "Display each single post's category", 'advanced-sidebar-menu' ); ?>
105
- <select id="<?php echo $this->get_field_name( self::EACH_CATEGORY_DISPLAY ); ?>"
106
- name="<?php echo $this->get_field_name( self::EACH_CATEGORY_DISPLAY ); ?>">
107
- <?php
108
- if( $instance[ self::EACH_CATEGORY_DISPLAY ] === 'widget' ){
109
- ?>
110
- <option value="widget" selected>
111
- <?php _e( 'In a new widget', 'advanced-sidebar-menu' ); ?>
112
- </option>
113
- <option value="list">
114
- <?php _e( 'In another list in the same widget', 'advanced-sidebar-menu' ); ?>
115
- </option>
116
- <?php
117
- } else {
118
- ?>
119
- <option value="widget">
120
- <?php _e( 'In a new widget', 'advanced-sidebar-menu' ); ?>
121
- </option>
122
- <option value="list" selected>
123
- <?php _e( 'In another list in the same widget', 'advanced-sidebar-menu' ); ?>
124
- </option>
125
- <?php
126
- }
127
-
128
- ?></select>
129
- </p>
130
- </span>
131
-
132
-
133
- <p>
134
- <?php _e( 'Categories to exclude (ids), comma separated', 'advanced-sidebar-menu' ); ?>:
135
- <input id="<?php echo $this->get_field_name( self::EXCLUDE ); ?>"
136
- name="<?php echo $this->get_field_name( self::EXCLUDE ); ?>" type="text" class="widefat" value="<?php echo $instance[ self::EXCLUDE ]; ?>"/>
137
- </p>
138
-
139
- <p> <?php _e( 'Always display child categories', 'advanced-sidebar-menu' ); ?>
140
- <input id="<?php echo $this->get_field_name( self::DISPLAY_ALL ); ?>"
141
- name="<?php echo $this->get_field_name( self::DISPLAY_ALL ); ?>" type="checkbox" value="checked"
142
- onclick="javascript:asm_reveal_element( 'levels-<?php echo $this->get_field_name( self::LEVELS ); ?>' )"
143
- <?php echo $instance[ self::DISPLAY_ALL ]; ?>/>
144
- </p>
145
-
146
- <span id="levels-<?php echo $this->get_field_name( self::LEVELS ); ?>" style="<?php
147
- if( $instance[ self::DISPLAY_ALL ] === 'checked' ){
148
- echo 'display:block';
149
- } else {
150
- echo 'display:none';
151
- } ?>">
152
- <p>
153
- <?php _e( 'Levels to display', 'advanced-sidebar-menu' ); ?>
154
- <select id="<?php echo $this->get_field_name( self::LEVELS ); ?>"
155
- name="<?php echo $this->get_field_name( self::LEVELS ); ?>">
156
- <?php
157
- for( $i = 1; $i < 6; $i ++ ){
158
- if( $i === (int) $instance[ 'levels' ] ){
159
- echo '<option value="' . $i . '" selected>' . $i . '</option>';
160
- } else {
161
- echo '<option value="' . $i . '">' . $i . '</option>';
162
}
163
- }
164
- ?>
165
- </select>
166
- </p>
167
- </span>
168
- <?php
169
170
- do_action( 'advanced_sidebar_menu_category_widget_form', $instance, $this );
171
172
- do_action( 'advanced_sidebar_menu_after_widget_form', $instance, $this );
173
174
}
175
176
177
/**
178
- * Updates the widget data
179
*
180
- * @filter - $newInstance = apply_filters('advanced_sidebar_menu_category_widget_update', $newInstance,
181
- * $oldInstance );
182
- * @since 5.19.13
183
*/
184
- public function update( $newInstance, $oldInstance ) {
185
- $newInstance[ 'exclude' ] = strip_tags( $newInstance[ 'exclude' ] );
186
- $newInstance = apply_filters( 'advanced_sidebar_menu_category_widget_update', $newInstance, $oldInstance );
187
188
- return $newInstance;
189
}
190
191
@@ -202,8 +219,8 @@ class Advanced_Sidebar_Menu_Widget_Category extends WP_Widget {
202
* @return void
203
*/
204
public function widget( $args, $instance ) {
205
- $instance = wp_parse_args( $instance, self::$defaults );
206
- $asm = Advanced_Sidebar_Menu_Menus_Category::factory( $instance, $args );
207
208
do_action( 'advanced_sidebar_menu_widget_pre_render', $asm, $this );
209
10
*
11
*
12
*/
13
+ class Advanced_Sidebar_Menu_Widget_Category extends Advanced_Sidebar_Menu__Widget__Widget {
14
const TITLE = Advanced_Sidebar_Menu_Menus_Abstract::TITLE;
15
const INCLUDE_PARENT = Advanced_Sidebar_Menu_Menus_Abstract::INCLUDE_PARENT;
16
const INCLUDE_CHILDLESS_PARENT = Advanced_Sidebar_Menu_Menus_Abstract::INCLUDE_CHILDLESS_PARENT;
37
38
39
public function __construct() {
40
+ $widget_ops = array(
41
'classname' => 'advanced-sidebar-menu advanced-sidebar-category',
42
'description' => __( 'Creates a menu of all the categories using the child/parent relationship', 'advanced-sidebar-menu' ),
43
);
44
+ $control_ops = array( 'width' => 620 );
45
46
parent::__construct( 'advanced_sidebar_menu_category', __( 'Advanced Sidebar Categories Menu', 'advanced-sidebar-menu' ), $widget_ops, $control_ops );
47
}
48
49
50
/**
51
+ * Form
52
*
53
+ * @since 7.2.0
54
*
55
* @param array $instance
56
*
57
* @return void
58
*/
59
public function form( $instance ) {
60
+ $instance = $this->set_instance( $instance, self::$defaults );
61
?>
62
+ <p>
63
+ <label>
64
+ <?php esc_html_e( 'Title', 'advanced-sidebar-menu' ); ?>:
65
+ </label>
66
+
67
+ <input
68
+ id="<?php echo esc_attr( $this->get_field_id( self::TITLE ) ); ?>"
69
+ name="<?php echo esc_attr( $this->get_field_name( self::TITLE ) ); ?>"
70
+ class="widefat"
71
+ type="text"
72
+ value="<?php echo esc_attr( $instance[ self::TITLE ] ); ?>"/>
73
+ </p>
74
+ <div class="advanced-sidebar-menu-column">
75
+ <div class="advanced-sidebar-menu-column-box">
76
+ <p>
77
+ <?php $this->checkbox( self::INCLUDE_PARENT ); ?>
78
+ <label>
79
+ <?php esc_html_e( 'Display highest level parent category', 'advanced-sidebar-menu' ); ?>
80
+ </label>
81
+ </p>
82
+
83
+
84
+ <p>
85
+ <?php $this->checkbox( self::INCLUDE_CHILDLESS_PARENT ); ?>
86
+ <label>
87
+ <?php esc_html_e( 'Display menu when there is only the parent category', 'advanced-sidebar-menu' ); ?>
88
+ </label>
89
+ </p>
90
+
91
+ <p>
92
+ <?php $this->checkbox( self::DISPLAY_ALL, self::LEVELS ); ?>
93
+ <label>
94
+ <?php esc_html_e( 'Always display child categories', 'advanced-sidebar-menu' ); ?>
95
+ </label>
96
+ </p>
97
+ <div
98
+ data-js="<?php echo esc_attr( $this->get_field_id( self::LEVELS ) ); ?>"
99
+ <?php $this->hide_element( self::DISPLAY_ALL ); ?>>
100
+ <p>
101
+ <label>
102
+ <?php esc_html_e( 'Levels to display', 'advanced-sidebar-menu' ); ?>:</label>
103
+ <select
104
+ name="<?php echo esc_attr( $this->get_field_name( self::LEVELS ) ); ?>">
105
+ <?php
106
+ for ( $i = 1; $i < 6; $i ++ ) {
107
+ ?>
108
+ <option
109
+ value="<?php echo esc_attr( $i ); ?>" <?php selected( $i, (int) $instance[ self::LEVELS ] ); ?>>
110
+ <?php echo esc_html( $i ); ?>
111
+ </option>
112
+
113
+ <?php
114
+ }
115
+ ?>
116
+ </select>
117
+ </p>
118
+ </div>
119
+
120
+ <?php do_action( 'advanced-sidebar-menu/widget/category/display-box', $instance, $this ); ?>
121
+
122
+ </div>
123
+ <div class="advanced-sidebar-menu-column-box">
124
+ <p>
125
+
126
+ <?php $this->checkbox( self::DISPLAY_ON_SINGLE, self::EACH_CATEGORY_DISPLAY ); ?>
127
+ <label>
128
+ <?php esc_html_e( 'Display categories on single posts', 'advanced-sidebar-menu' ); ?>
129
+ </label>
130
+ </p>
131
+
132
+ <div
133
+ data-js="<?php echo esc_attr( $this->get_field_id( self::EACH_CATEGORY_DISPLAY ) ); ?>" <?php $this->hide_element( self::DISPLAY_ON_SINGLE, $instance ); ?>>
134
+ <p>
135
+ <label><?php esc_html_e( "Display each single post's category", 'advanced-sidebar-menu' ); ?>
136
+ :</label>
137
+ <select
138
+ name="<?php echo esc_attr( $this->get_field_name( self::EACH_CATEGORY_DISPLAY ) ); ?>">
139
+ <option
140
+ value="widget" <?php selected( 'widget', $instance[ self::EACH_CATEGORY_DISPLAY ] ); ?>>
141
+ <?php esc_html_e( 'In a new widget', 'advanced-sidebar-menu' ); ?>
142
+ </option>
143
+ <option value="list" <?php selected( 'list', $instance[ self::EACH_CATEGORY_DISPLAY ] ); ?>>
144
+ <?php esc_html_e( 'In another list in the same widget', 'advanced-sidebar-menu' ); ?>
145
+ </option>
146
+ </select>
147
+ </p>
148
+ </div>
149
+
150
+ <?php do_action( 'advanced-sidebar-menu/widget/category/singles-box', $instance, $this ); ?>
151
+
152
+ </div>
153
+
154
+ <div class="advanced-sidebar-menu-column-box">
155
+ <p>
156
+ <label>
157
+ <?php esc_html_e( 'Categories to exclude (ids), comma separated', 'advanced-sidebar-menu' ); ?>:
158
+ </label>
159
+ <input
160
+ id="<?php echo esc_attr( $this->get_field_id( self::EXCLUDE ) ); ?>"
161
+ name="<?php echo esc_attr( $this->get_field_name( self::EXCLUDE ) ); ?>"
162
+ type="text"
163
+ class="widefat"
164
+ value="<?php echo esc_attr( $instance[ self::EXCLUDE ] ); ?>"/>
165
+ </p>
166
+
167
+ <?php
168
+ do_action( 'advanced-sidebar-menu/widget/category/exclude-box', $instance, $this );
169
+ ?>
170
+ </div>
171
+
172
+ <?php
173
+ if ( has_action( 'advanced_sidebar_menu_category_widget_form' ) ) {
174
+ ?>
175
+ <div class="advanced-sidebar-menu-column-box">
176
+ <?php do_action( 'advanced_sidebar_menu_category_widget_form', $instance, $this ); ?>
177
+ </div>
178
+ <?php
179
}
180
181
+ ?>
182
+ </div>
183
184
+ <div class="advanced-sidebar-menu-column advanced-sidebar-menu-column-right">
185
+ <?php
186
+ do_action( 'advanced_sidebar_menu_after_widget_form', $instance, $this );
187
+ ?>
188
+ </div>
189
+ <?php
190
191
}
192
193
194
/**
195
+ * Update
196
+ *
197
+ * @param array $new_instance
198
+ * @param array $old_instance
199
*
200
+ * @return array|mixed
201
*/
202
+ public function update( $new_instance, $old_instance ) {
203
+ $new_instance['exclude'] = strip_tags( $new_instance['exclude'] );
204
205
+ return apply_filters( 'advanced_sidebar_menu_category_widget_update', $new_instance, $old_instance );
206
}
207
208
219
* @return void
220
*/
221
public function widget( $args, $instance ) {
222
+ $instance = $this->set_instance( $instance, self::$defaults );
223
+ $asm = Advanced_Sidebar_Menu_Menus_Category::factory( $instance, $args );
224
225
do_action( 'advanced_sidebar_menu_widget_pre_render', $asm, $this );
226
src/Widget/Page.php CHANGED
@@ -10,7 +10,7 @@
10
* @since 7.0.0
11
*
12
*/
13
- class Advanced_Sidebar_Menu_Widget_Page extends WP_Widget {
14
const TITLE = Advanced_Sidebar_Menu_Menus_Abstract::TITLE;
15
const INCLUDE_PARENT = Advanced_Sidebar_Menu_Menus_Abstract::INCLUDE_PARENT;
16
const INCLUDE_CHILDLESS_PARENT = Advanced_Sidebar_Menu_Menus_Abstract::INCLUDE_CHILDLESS_PARENT;
@@ -33,12 +33,12 @@ class Advanced_Sidebar_Menu_Widget_Page extends WP_Widget {
33
34
35
public function __construct() {
36
- $widget_ops = array(
37
'classname' => 'advanced-sidebar-menu',
38
'description' => __( 'Creates a menu of all the pages using the child/parent relationship', 'advanced-sidebar-menu' ),
39
);
40
$control_ops = array(
41
- 'width' => 290,
42
);
43
44
parent::__construct( 'advanced_sidebar_menu', __( 'Advanced Sidebar Pages Menu', 'advanced-sidebar-menu' ), $widget_ops, $control_ops );
@@ -60,107 +60,142 @@ class Advanced_Sidebar_Menu_Widget_Page extends WP_Widget {
60
* @return void
61
*/
62
public function form( $instance ) {
63
- $instance = wp_parse_args( $instance, self::$defaults );
64
?>
65
- <p> <?php _e( 'Title', 'advanced-sidebar-menu' ); ?>
66
- <br>
67
- <input id="<?php echo $this->get_field_id( self::TITLE ); ?>"
68
- name="<?php echo $this->get_field_name( self::TITLE ); ?>" class="widefat" type="text" value="<?php echo $instance[ self::TITLE ]; ?>"/>
69
- </p>
70
-
71
- <p> <?php _e( 'Display highest level parent page', 'advanced-sidebar-menu' ); ?>:
72
- <input id="<?php echo $this->get_field_id( self::INCLUDE_PARENT ); ?>"
73
- name="<?php echo $this->get_field_name( self::INCLUDE_PARENT ); ?>" type="checkbox" value="checked"
74
- <?php echo $instance[ self::INCLUDE_PARENT ]; ?>/>
75
- </p>
76
-
77
-
78
- <p> <?php _e( 'Display menu when there is only the parent page', 'advanced-sidebar-menu' ); ?>:
79
- <input id="<?php echo $this->get_field_id( self::INCLUDE_CHILDLESS_PARENT ); ?>"
80
- name="<?php echo $this->get_field_name( 'include_childless_parent' ); ?>" type="checkbox" value="checked"
81
- <?php echo $instance[ self::INCLUDE_CHILDLESS_PARENT ]; ?>/>
82
- </p>
83
-
84
- <p> <?php _e( 'Order by', 'advanced-sidebar-menu' ); ?>:
85
- <select id="<?php echo $this->get_field_id( self::ORDER_BY ); ?>"
86
- name="<?php echo $this->get_field_name( self::ORDER_BY ); ?>">
87
<?php
88
-
89
- $order_by = array(
90
- 'menu_order' => 'Page Order',
91
- 'post_title' => 'Title',
92
- 'post_date' => 'Published Date',
93
- );
94
-
95
- foreach( $order_by as $key => $order ){
96
-
97
- printf( '<option value="%s" %s>%s</option>', $key, selected( $instance[ self::ORDER_BY ], $key, false ), $order );
98
- }
99
?>
100
- </select>
101
- </p>
102
-
103
- <p> <?php _e( "Use this plugin's default styling", 'advanced-sidebar-menu' ); ?>:
104
- <input id="<?php echo $this->get_field_id( self::USE_PLUGIN_STYLES ); ?>"
105
- name="<?php echo $this->get_field_name( self::USE_PLUGIN_STYLES ); ?>" type="checkbox" value="checked"
106
- <?php echo $instance[ self::USE_PLUGIN_STYLES ]; ?>/>
107
- </p>
108
-
109
- <p> <?php _e( 'Pages to exclude (ids), comma separated', 'advanced-sidebar-menu' ); ?>:
110
- <input id="<?php echo $this->get_field_id( self::EXCLUDE ); ?>"
111
- name="<?php echo $this->get_field_name( self::EXCLUDE ); ?>" class="widefat" type="text" value="<?php echo $instance[ self::EXCLUDE ]; ?>"/>
112
- </p>
113
-
114
- <p> <?php _e( 'Always display child pages', 'advanced-sidebar-menu' ); ?>:
115
- <input
116
- id="<?php echo $this->get_field_id( self::DISPLAY_ALL ); ?>"
117
- name="<?php echo $this->get_field_name( self::DISPLAY_ALL ); ?>"
118
- type="checkbox"
119
- value="checked"
120
- data-js="advanced-sidebar-menu/widget/page/display_all"
121
- onclick="javascript:asm_reveal_element( 'levels-<?php echo $this->get_field_id( self::LEVELS ); ?>' )"
122
- <?php echo $instance[ self::DISPLAY_ALL ]; ?>/>
123
- </p>
124
-
125
- <span id="levels-<?php echo $this->get_field_id( self::LEVELS ); ?>" style="<?php
126
- if( $instance[ 'display_all' ] === 'checked' ){
127
- echo 'display:block';
128
- } else {
129
- echo 'display:none';
130
- } ?>">
131
- <p> <?php _e( 'Levels to display', 'advanced-sidebar-menu' ); ?>:
132
- <select id="<?php echo $this->get_field_id( self::LEVELS ); ?>"
133
- name="<?php echo $this->get_field_name( self::LEVELS ); ?>">
134
- <?php
135
- for( $i = 1; $i < 6; $i ++ ){
136
- if( $i === (int) $instance[ self::LEVELS ] ){
137
- echo '<option value="' . $i . '" selected>' . $i . '</option>';
138
- } else {
139
- echo '<option value="' . $i . '">' . $i . '</option>';
140
}
141
- }
142
- echo '</select></p></span>';
143
-
144
- do_action( 'advanced_sidebar_menu_page_widget_form', $instance, $this->get_field_name( 'parent_only' ), $this->get_field_id( 'parent_only' ), $this );
145
-
146
- do_action( 'advanced_sidebar_menu_after_widget_form', $instance, $this );
147
148
}
149
150
151
/**
152
- * Handles the saving of the widget
153
*
154
- * @filters apply_filters('advanced_sidebar_menu_page_widget_update', $newInstance, $oldInstance );
155
*
156
- * @since 4.26.13
157
*/
158
- public function update( $newInstance, $oldInstance ) {
159
- $newInstance[ 'exclude' ] = strip_tags( $newInstance[ 'exclude' ] );
160
-
161
- $newInstance = apply_filters( 'advanced_sidebar_menu_page_widget_update', $newInstance, $oldInstance );
162
163
- return $newInstance;
164
}
165
166
@@ -178,7 +213,7 @@ class Advanced_Sidebar_Menu_Widget_Page extends WP_Widget {
178
*/
179
public function widget( $args, $instance ) {
180
$instance = wp_parse_args( $instance, self::$defaults );
181
- $asm = Advanced_Sidebar_Menu_Menus_Page::factory( $instance, $args );
182
183
do_action( 'advanced_sidebar_menu_widget_pre_render', $asm, $this );
184
10
* @since 7.0.0
11
*
12
*/
13
+ class Advanced_Sidebar_Menu_Widget_Page extends Advanced_Sidebar_Menu__Widget__Widget {
14
const TITLE = Advanced_Sidebar_Menu_Menus_Abstract::TITLE;
15
const INCLUDE_PARENT = Advanced_Sidebar_Menu_Menus_Abstract::INCLUDE_PARENT;
16
const INCLUDE_CHILDLESS_PARENT = Advanced_Sidebar_Menu_Menus_Abstract::INCLUDE_CHILDLESS_PARENT;
33
34
35
public function __construct() {
36
+ $widget_ops = array(
37
'classname' => 'advanced-sidebar-menu',
38
'description' => __( 'Creates a menu of all the pages using the child/parent relationship', 'advanced-sidebar-menu' ),
39
);
40
$control_ops = array(
41
+ 'width' => 620,
42
);
43
44
parent::__construct( 'advanced_sidebar_menu', __( 'Advanced Sidebar Pages Menu', 'advanced-sidebar-menu' ), $widget_ops, $control_ops );
60
* @return void
61
*/
62
public function form( $instance ) {
63
+ $instance = $this->set_instance( $instance, self::$defaults );
64
?>
65
+ <p xmlns="http://www.w3.org/1999/html">
66
+ <label>
67
+ <?php esc_html_e( 'Title', 'advanced-sidebar-menu' ); ?>:
68
+ </label>
69
+
70
+ <input
71
+ id="<?php echo esc_attr( $this->get_field_id( self::TITLE ) ); ?>"
72
+ name="<?php echo esc_attr( $this->get_field_name( self::TITLE ) ); ?>"
73
+ class="widefat"
74
+ type="text"
75
+ value="<?php echo esc_attr( $instance[ self::TITLE ] ); ?>"/>
76
+ </p>
77
+ <div class="advanced-sidebar-menu-column">
78
+ <div class="advanced-sidebar-menu-column-box">
79
+ <p>
80
+ <?php $this->checkbox( self::INCLUDE_PARENT ); ?>
81
+ <label>
82
+ <?php esc_html_e( 'Display highest level parent page', 'advanced-sidebar-menu' ); ?>
83
+ </label>
84
+ </p>
85
+
86
+
87
+ <p>
88
+ <?php $this->checkbox( self::INCLUDE_CHILDLESS_PARENT ); ?>
89
+ <label>
90
+ <?php esc_html_e( 'Display menu when there is only the parent page', 'advanced-sidebar-menu' ); ?>
91
+ </label>
92
+ </p>
93
+
94
+ <p>
95
+ <?php $this->checkbox( self::DISPLAY_ALL, self::LEVELS ); ?>
96
+ <label>
97
+ <?php esc_html_e( 'Always display child pages', 'advanced-sidebar-menu' ); ?>:
98
+ </label>
99
+ </p>
100
+
101
+ <div
102
+ data-js="<?php echo esc_attr( $this->get_field_id( self::LEVELS ) ); ?>"
103
+ <?php $this->hide_element( self::DISPLAY_ALL ); ?>>
104
+ <p>
105
+ <label>
106
+ <?php esc_html_e( 'Levels to display', 'advanced-sidebar-menu' ); ?>:</label>
107
+ <select
108
+ name="<?php echo esc_attr( $this->get_field_name( self::LEVELS ) ); ?>">
109
+ <?php
110
+ for ( $i = 1; $i < 6; $i ++ ) {
111
+ ?>
112
+ <option
113
+ value="<?php echo esc_attr( $i ); ?>" <?php selected( $i, (int) $instance[ self::LEVELS ] ); ?>>
114
+ <?php echo esc_html( $i ); ?>
115
+ </option>
116
+
117
+ <?php
118
+ }
119
+ ?>
120
+ </select>
121
+ </p>
122
+ </div>
123
+
124
+ <?php do_action( 'advanced-sidebar-menu/widget/page/display-box', $instance, $this ); ?>
125
+
126
+ </div>
127
+ <div class="advanced-sidebar-menu-column-box">
128
+ <p>
129
+ <label>
130
+ <?php esc_html_e( 'Order by', 'advanced-sidebar-menu' ); ?>:
131
+ </label>
132
+ <select
133
+ id="<?php echo esc_attr( $this->get_field_id( self::ORDER_BY ) ); ?>"
134
+ name="<?php echo esc_attr( $this->get_field_name( self::ORDER_BY ) ); ?>">
135
+ <?php
136
+ $order_by = (array) apply_filters( 'advanced-sidebar-menu/widget/page/order-by-options', array(
137
+ 'menu_order' => 'Page Order',
138
+ 'post_title' => 'Title',
139
+ 'post_date' => 'Published Date',
140
+ ) );
141
+
142
+ foreach ( $order_by as $key => $order ) {
143
+ printf( '<option value="%s" %s>%s</option>', esc_attr( $key ), selected( $instance[ self::ORDER_BY ], $key, false ), esc_html( $order ) );
144
+ }
145
+ ?>
146
+ </select>
147
+ </p>
148
+ <?php do_action( 'advanced-sidebar-menu/widget/page/order-box', $instance, $this ); ?>
149
+
150
+ </div>
151
+ <div class="advanced-sidebar-menu-column-box">
152
+ <p>
153
+ <label>
154
+ <?php esc_html_e( 'Pages to exclude (ids), comma separated', 'advanced-sidebar-menu' ); ?>:
155
+ </label>
156
+ <input
157
+ id="<?php echo esc_attr( $this->get_field_id( self::EXCLUDE ) ); ?>"
158
+ name="<?php echo esc_attr( $this->get_field_name( self::EXCLUDE ) ); ?>"
159
+ class="widefat"
160
+ type="text"
161
+ value="<?php echo esc_attr( $instance[ self::EXCLUDE ] ); ?>"/>
162
+ </p>
163
<?php
164
+ do_action( 'advanced-sidebar-menu/widget/page/exclude-box', $instance, $this );
165
?>
166
+ </div>
167
+ <?php
168
+ if ( has_action( 'advanced_sidebar_menu_page_widget_form' ) ) {
169
+ ?>
170
+ <div class="advanced-sidebar-menu-column-box">
171
+ <?php do_action( 'advanced_sidebar_menu_page_widget_form', $this->get_field_id( 'parent_only' ), $this, $instance ); ?>
172
+ </div>
173
+ <?php
174
}
175
+ ?>
176
+ </div>
177
+ <div class="advanced-sidebar-menu-column advanced-sidebar-menu-column-right">
178
+ <?php
179
+ do_action( 'advanced_sidebar_menu_after_widget_form', $instance, $this );
180
+ ?>
181
+ </div>
182
+ <?php
183
184
}
185
186
187
/**
188
+ * Update
189
*
190
+ * @param array $new_instance
191
+ * @param array $old_instance
192
*
193
+ * @return array|mixed
194
*/
195
+ public function update( $new_instance, $old_instance ) {
196
+ $new_instance['exclude'] = strip_tags( $new_instance['exclude'] );
197
198
+ return apply_filters( 'advanced_sidebar_menu_page_widget_update', $new_instance, $old_instance );
199
}
200
201
213
*/
214
public function widget( $args, $instance ) {
215
$instance = wp_parse_args( $instance, self::$defaults );
216
+ $asm = Advanced_Sidebar_Menu_Menus_Page::factory( $instance, $args );
217
218
do_action( 'advanced_sidebar_menu_widget_pre_render', $asm, $this );
219
src/Widget/Widget.php ADDED
@@ -0,0 +1,104 @@
1
+ <?php
2
+
3
+ /**
4
+ * Advanced_Sidebar_Menu__Widget__Widget
5
+ *
6
+ * @author Mat Lipe
7
+ *
8
+ * @since 7.2.0
9
+ *
10
+ */
11
+ abstract class Advanced_Sidebar_Menu__Widget__Widget extends WP_Widget {
12
+ protected $_instance;
13
+
14
+
15
+ /**
16
+ * Store the instance to this class.
17
+ * We do this manually because there are filters etc which
18
+ * hit the instance before we get in in self::form() and self::widget()
19
+ *
20
+ * @see WP_Widget::form_callback()
21
+ *
22
+ * @param array $instance
23
+ * @param array $defaults
24
+ *
25
+ * @since 7.2.0
26
+ *
27
+ * @return array
28
+ */
29
+ protected function set_instance( array $instance, array $defaults ) {
30
+ $instance = wp_parse_args( $instance, $defaults );
31
+ $this->_instance = $instance;
32
+
33
+ return $instance;
34
+
35
+ }
36
+
37
+
38
+ /**
39
+ * Checks if a widgets checkbox is checked.
40
+ *
41
+ * Checks first for a value then verifies the value = checked
42
+ *
43
+ * @param string $name - name of checkbox.
44
+ *
45
+ * @since 7.2.0
46
+ *
47
+ * @return bool
48
+ */
49
+ public function checked( $name ) {
50
+ return isset( $this->_instance[ $name ] ) && 'checked' === $this->_instance[ $name ];
51
+ }
52
+
53
+
54
+ /**
55
+ * Hide an element if a checkbox is checked.
56
+ *
57
+ * @param string $checkbox - name of checkbox element which controls this one
58
+ * @param bool $reverse - hide on check instead of show on check
59
+ *
60
+ * @since 7.2.0
61
+ *
62
+ * @return void
63
+ */
64
+ public function hide_element( $checkbox, $reverse = false ) {
65
+ if ( $reverse ) {
66
+ if ( $this->checked( $checkbox ) ) {
67
+ ?>style="display:none"<?php
68
+ }
69
+ } else {
70
+ if ( ! $this->checked( $checkbox ) ) {
71
+ ?>style="display:none"<?php
72
+ }
73
+ }
74
+ }
75
+
76
+
77
+ /**
78
+ * Outputs a <input type="checkbox" with id and name filled
79
+ *
80
+ * @param string $name
81
+ * @param string|null $reveal_element
82
+ *
83
+ * @since 7.2.0
84
+ *
85
+ */
86
+ public function checkbox( $name, $reveal_element = null ) {
87
+ if ( empty( $this->_instance[ $name ] ) ) {
88
+ $this->_instance[ $name ] = null;
89
+ }
90
+
91
+ ?>
92
+ <input
93
+ id="<?php echo esc_attr( $this->get_field_id( $name ) ); ?>"
94
+ name="<?php echo esc_attr( $this->get_field_name( $name ) ); ?>"
95
+ type="checkbox"
96
+ value="checked"
97
+ data-js="advanced-sidebar-menu/widget/<?php echo esc_attr( $this->id_base ); ?>/<?php echo esc_attr( $name ); ?>"
98
+ <?php echo ( null !== $reveal_element ) ? 'onclick="asm_reveal_element( \'' . esc_attr( $this->get_field_id( $reveal_element ) ) . '\')"' : ''; ?>
99
+ <?php echo esc_html( $this->_instance[ $name ] ); ?>
100
+ />
101
+ <?php
102
+
103
+ }
104
+ }
views/sidebar-menu.css DELETED
@@ -1,39 +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
- margin: 0;
26
-
27
- }
28
-
29
- .advanced-sidebar-menu li.current_page_item{
30
- list-style-type: disc;
31
- }
32
-
33
- .advanced-sidebar-menu li.current_page_item a{
34
- font-weight: bold;
35
- }
36
-
37
- .advanced-sidebar-menu li.current_page_item li a{
38
- font-weight: normal;
39
- }