-
Notifications
You must be signed in to change notification settings - Fork 3
/
sidebar.php
85 lines (61 loc) · 1.56 KB
/
sidebar.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
<?php
/**
* The sidebar containing the main widget area.
*
* @package DocPress
*/
?>
<?php
/**
*
* Get Categories
*
* @since 1.0.0
*/
$dp_categories = get_categories();
?>
<nav class="nav-main" id="nav" role="navigation">
<ul class="main-menu">
<?php
/**
*
* List all categories as main-menu-item
*
*/
foreach ($dp_categories as $dp_category) {
?>
<li>
<a href="#" class="menu-item">
<span class="main-menu-item">
<i class="glyphicon glyphicon-cog"></i><?php echo $dp_category->name; ?><span class="glyphicon glyphicon-chevron-right"></span>
</span>
</a>
<ul class="sub-menu">
<?php
/**
*
* Query all the post titles in particular category
*
*/
$dp_cat_id = $dp_category->term_id;
/**
* Query the category in question
*
*/
$dp_loop_args = array(
'cat' => $dp_cat_id,
'order' => 'ASC',
'posts_per_page' => -1
);
$dp_cat_post_titles = new WP_Query( $dp_loop_args );
while ( $dp_cat_post_titles->have_posts() ) : $dp_cat_post_titles->the_post();
?>
<li><a class="sub-menu-item" href="#dp_<?php the_id(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
</li>
<?php
}
?>
</ul>
</nav>