-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathsidebar-navigation.php
112 lines (111 loc) · 3.42 KB
/
sidebar-navigation.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/**
* Sidebar Navigation Template Part
*
* Template part file that contains the sidebar navigation
* menu.
*
* By default, this sidebar navigation will output
* the descendant menu to the current top-level static
* Page, and will output up to three additional levels
* of Page hierarchy. The default menu is incredibly
* flexible and powerful, because it updates dynamically
* whenever the user changes Page hierarchy, by adding
* or removing Pages, or by changing the child-parent
* relationship for Pages.
*
* However, users can override this menu output by
* creating a custom navigation menu, and assigning it
* to the 'nav-sidebar' Theme location.
*
* This file is called by static Pages
*
* @link http://codex.wordpress.org/Function_Reference/has_nav_menu has_nav_menu()
* @link http://codex.wordpress.org/Function_Reference/wp_list_pages wp_list_pages()
* @link http://codex.wordpress.org/Function_Reference/wp_nav_menu wp_nav_menu()
*
* @package Oenology
* @copyright Copyright (c) 2010, Chip Bennett
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License, v2 (or newer)
*
* @since Oenology 2.0
*/
?>
<!-- Page Subnavigation Menu -->
<?php
/**
* Output the sidebar navigation menu
*
* If the user has defined a custom navigation menu
* and has applied that menu to the 'nav-sidebar'
* theme location, then output that menu. Otherwise,
* output a list of Pages.
*
* The menu displays the descendant menu to the
* current top-level static Page, and will output
* up to three additional levels of Page hierarchy.
*
* NOTE: list items are set to overflow:hidden.
* Long page titles will be cut off, but the full
* Page Title will display in the tooltip
*/
if (
/**
* WordPress conditional tag that returns true if
* the user has applied a custom navigation menu
* to the specified theme location
*/
has_nav_menu( 'nav-sidebar' )
) {
/**
* Output a custom navigation menu
*
* Output a custom navigation menu
* according to the parameters
* specified by the options array
*
* @param array options defining menu output
*/
wp_nav_menu( array(
// apply 'id="subnav"' to the <ul> tag that contains the menu.
'menu_id' => 'subnav',
// apply 'class="subnavmenu"' to the <ul> tag that contains the menu.
'menu_class' => 'subnavmenu',
// Use the default fallback if the user has not applied a menu to the specified theme location.
'fallback_cb' => '',
// Apply four levels hierarchical depth, i.e. Parent Page plus three levels of descendant Child Pages.
'depth' => 4,
// Output the menu the user has applied to the 'nav-sidebar' Theme Location.
'theme_location' => 'nav-sidebar'
) );
}
else {
/**
* Otherwise, if the user has not applied a
* menu to the 'nav-header' Theme location,
* output a list of static Pages.
*/
?>
<ul class="subnavmenu">
<?php
/**
* Output a list of static Pages
*
* Output a custom navigation menu
* according to the parameters
* specified by the options array
*
* @param array options defining menu output
*/
wp_list_pages( array(
// Display four levels of Page hierarchy i.e. three levels of child pages).
'depth' => 4,
// Sort pages as defined by the user in the Pages administration panel.
'sort_column' => 'menu_order',
// Do not wrap list in <ul> tags, and do not give the menu a title <li>.
'title_li' => ''
) );
?>
</ul>
<?php
}