-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.php
More file actions
57 lines (55 loc) · 2.11 KB
/
page.php
File metadata and controls
57 lines (55 loc) · 2.11 KB
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
<?php
get_header();
while(have_posts()){
the_post();?>
<div class="page-banner">
<div class="page-banner__bg-image" style="background-image: url(<?php echo get_theme_file_uri('images/ocean.jpg')?>)"></div>
<div class="page-banner__content container container--narrow">
<h1 class="page-banner__title"><?php the_title();?></h1>
<div class="page-banner__intro">
<p>Learn how the school of your dreams got started.</p>
</div>
</div>
</div>
<div class="container container--narrow page-section">
<?php
$theParent = wp_get_post_parent_id(get_the_ID());
if($theParent){?> <!-- $theParent holds the parent id -->
<div class="metabox metabox--position-up metabox--with-home-link">
<p>
<a class="metabox__blog-home-link" href="<?php echo get_permalink($theParent);?>"><i class="fa fa-home" aria-hidden="true"></i> Back to <?php echo get_the_title($theParent);?></a> <span class="metabox__main"><?php the_title();?></span>
</p>
</div>
<?php }
?>
<?php
$testArray = get_pages(array( # child of the current post/page
'child_of' => get_the_ID()
));
if($theParent or $testArray){ ?><!-- if the current post has a parent or if it's child post-->
<div class="page-links">
<h2 class="page-links__title"><a href="<?php echo get_permalink($theParent); ?>"><?php echo get_the_title($theParent);?></a></h2>
<ul class="min-list">
<?php
if($theParent){ # for the child post
$findChildrenOf = $theParent;
} else { # for the parent post
$findChildrenOf = get_the_ID();
}
wp_list_pages(array(
'title_li' => NULL,
'child_of' => $findChildrenOf,
'sort_column' => 'menu_order'
));
?>
</ul>
</div>
<?php }?>
<div class="generic-content">
<?php the_content();?>
</div>
</div>
<?php
}
get_footer();
?>