-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage.php
66 lines (54 loc) · 1.83 KB
/
page.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
<!-- individual pages -->
<?php
get_header();
while(have_posts()) {
the_post(); ?>
<section class="generic-content">
<div>
<ul class="breadcrumbs">
<li><a href="<?php echo site_url("/") ?>">Home</a></li>
<?php
$parentPageId = wp_get_post_parent_id(get_the_ID());
$child_url = get_permalink($parentPageId);
$child_text = get_the_title($parentPageId);
if($parentPageId) {
echo "<li><a href='$child_url'>$child_text</a></li>";
}
?>
<li><?php the_title() ?></li>
</ul>
</div>
<h2 class="generic-content__heading"><?php the_title() ?></h2>
<p class="generic-content__text"><?php the_content()?></p>
<?php
$child_links = wp_list_pages(
array(
'title_li' => NULL,
'child_of' => get_the_ID(),
'echo' => 0 // Set 'echo' parameter to 0 to return the value instead of echoing it
)
);
$testArr = get_pages(array(
'child_of' => get_the_ID()
));
// We want to hide our html when no children to show so on two conditions
// 1. no children present
// 2. a child page w/ no children of its own
// Skip this feature for now
if($parentPageId) {
$findChildrenOf = $parentPageId;
} else {
$findChildrenOf = get_the_ID();
}
wp_list_pages(
array(
'title_li' => NULL,
'child_of' => $findChildrenOf,
)
);
?>
</section>
<?php
}
get_footer()
?>