-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpage.php
More file actions
59 lines (50 loc) · 1.63 KB
/
page.php
File metadata and controls
59 lines (50 loc) · 1.63 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
58
<?php
get_header();
while( have_posts() ) {
the_post();
pageBanner();
?>
<div class="container container--narrow page-section">
<?php
// theParent is true if current page is a child page
$theParent = wp_get_post_parent_id( get_the_ID() );
if ( $theParent ) { ?>
<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
$hasSubPages = get_pages( array(
'child_of' => get_the_ID() //lists the sub pages of the current page (children/grandchilds)
));
/* don't show links for single pages */
if ($theParent or $hasSubPages) { ?>
<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 ) {
$findChildrenOf = $theParent;
} else {
$findChildrenOf = get_the_ID();
}
wp_list_pages( array(
'title_li' => NULL, /* no heading and list items will not be wrapped */
'child_of' => $findChildrenOf
));
?>
</ul>
</div>
<?php
}
?>
<div class="generic-content">
<?php the_content(); ?>
</div>
</div>
<?php
}
get_footer();
?>