forked from michaelliunsky/niRvana-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsidebar.php
32 lines (32 loc) · 1.67 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
<?php
$sidebars = _opt('sidebars', array());
$sidebarContent = is_single() || is_page() ? get_the_naved_contentnav(get_the_content()) : false;?><script type="text/html" jQVue-template="sidebarMenu">
<div pandaTab class="sidebarMenu" active-class=".active" sub-trigger="click" sub-class=".sub-menu">
<ul class="menu"><?php
if ($sidebarContent) {?><li data-id="sidebar-0" show-on-single show-on-page><a data-toggle="tooltip" data-placement="auto top" title="<?php _eopt('bookmark_tip', '文章目录') ?>"><i class="fas fa-bookmark"></i></a></li><?php
}?><?php
for ($i=0; $i < count($sidebars); $i++) {
$dataId = 'sidebar-'.($i+1);
$showString = '';
if ($sidebars[$i]['show_on']) {
foreach ($sidebars[$i]['show_on'] as $item) {
$showString .= ' show-on-'.$item;
}
}?>
<li data-id="<?php echo $dataId;?>" <?php echo $showString; ?>><a data-toggle="tooltip" data-placement="auto top" title="<?php echo $sidebars[$i]['name'];?>"><?php echo $sidebars[$i]['icon'] ? $sidebars[$i]['icon'] : ' ';?></a></li><?php
}?>
</ul>
</div>
</script>
<script type="text/html" jQVue-template="sidebar">
<?php
if ($sidebarContent) {?><aside data-id="sidebar-0" class="sidebar" style="display: none;">
<h2 class="widgettitle"><?php _eopt('bookmark_tip', '文章目录') ?></h2><?php echo $sidebarContent; ?>
</aside><?php
}?><?php
for ($i=0; $i < count($sidebars); $i++) {
$dataId = 'sidebar-'.($i+1);?><aside data-id="<?php echo $dataId;?>" class="sidebar" style="display: none;">
<ul class="widget-list"><?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar($dataId)) : ?><?php endif; ?></ul>
</aside><?php
}?>
</script>