This repository has been archived by the owner on Jul 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidebar.php
73 lines (57 loc) · 1.72 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
<?php
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
/**
* The sidebar containing the main widget area.
*
* @package tsatu
*/
?>
<?php if (tsatu_display_sidebar()) : ?>
</div><!-- close .main-content-inner -->
<div class="sidebar">
<?php // add the class "panel" below here to wrap the sidebar in Bootstrap style ;) ?>
<div class="sidebar-padder">
<?php do_action('before_sidebar'); ?>
<?php
// Page sidebar
if (is_page()) {
// Page navigation
global $post;
if (wp_get_post_parent_id($post->ID)) {
$ancestors = array_reverse(get_post_ancestors($post->ID));
$top_ancestor_id = $ancestors[0];
} else {
$top_ancestor_id = $post->ID;
}
$title = get_the_title($top_ancestor_id);
$out = wp_list_pages(array(
'title_li' => '',
'child_of' => $top_ancestor_id,
'echo' => 0,
'sort_column' => 'menu_order'
));
if (!empty($out)) {
echo '<aside id="tsatu-pagenav" class="widget widget_pagenav">';
if ($title) {
echo '<h1 class="widget-title">' . $title . '</h1>';
}
echo '<ul id="pagenav">';
echo $out;
echo '</ul>';
echo '</aside>';
}
// Page widgets
dynamic_sidebar('sidebar-page');
}
// Post sidebar
else {
dynamic_sidebar('sidebar-default');
}
?>
<?php do_action('after_sidebar'); ?>
</div>
<!-- close .sidebar-padder -->
<?php endif; ?>