This repository has been archived by the owner on May 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
content-resources.php
60 lines (58 loc) · 1.74 KB
/
content-resources.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
<?php
//Initial Checking for showing the resources box
$withChild = false;
$subpages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'menu_order', 'sort_order' => 'asc' ) );
if ($subpages)
$withChild = true;
else {
$parent_id = $post->post_parent;
if ($parent_id>0)
$withChild = true;
}
?>
<div class="right_sid_mtr program_toc_box" id="toc">
<?php if ($withChild): ?>
<div class="col-md-12 col-sm-12 col-xs-12" style="border: 3px solid #294179;margin-bottom:10px;">
<div class="pblctn_box">
<span class="socl_icns fa-stack"><i class="fa fa-link"></i></span>
</div>
<div class="cntnbx_cntnr">
<span class="program_toc_header">Additional Info</span>
<ul class="program_toc">
<?php
if ($subpages) {
?>
<li>Main</li>
<?php
foreach($subpages as $spage) {
?>
<li><a href="<?php echo get_page_link($spage->ID); ?>"><?php echo $spage->post_title; ?></a></li>
<?php
}
} else {
//Get Parent of Page
$parent_id = $post->post_parent;
if ($parent_id>0) {
$parent_page = get_page($parent_id);
echo "<li><a href='".get_page_link($parent_id)."'>Main</a></li>";
//Display Sub page links
$subpages = get_pages( array( 'child_of' => $parent_id, 'sort_column' => 'menu_order', 'sort_order' => 'asc', 'parent' => $parent_id ) );
foreach($subpages as $spage) {
if ($post->ID==$spage->ID){
echo "<li>" . $spage->post_title . "</li>";
} else {
?>
<li><a href="<?php echo get_page_link($spage->ID); ?>"><?php echo $spage->post_title; ?></a></li>
<?php
}
}
}
}
?>
</ul>
<p>
</div>
</div>
<?php endif; ?>
<?php get_template_part( 'content', 'contact' ); ?>
</div>