-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage.php
82 lines (73 loc) · 1.63 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* Page Template
*
* This is the template used for Pages.
*
* Map First
*
* Learn More
*
* https://developer.wordpress.org/themes/basics/template-hierarchy/
*
**/
get_header();?>
<?php
//Content
if (have_posts()) {
//The Loop
while (have_posts()) {
the_post();
?>
<article id="post-<?php the_ID();?>" <?php post_class();?>>
<h1><?php the_title();?></h1>
<?php the_content();?>
</article>
<?php
}
echo '<hr class="py-2" />' . "\n";
//Home?
if (is_front_page()) {
echo '<p>Sitemap:</p>' . "\n";
echo '<ul>' . "\n";
wp_list_pages(array(
'title_li' => null,
'exclude' => get_option('page_on_front'),
));
echo '</ul>' . "\n";
}
//Children?
$post_children = get_posts(array(
'post_type' => $post->post_type,
'post_parent' => $post->ID,
));
if ($post_children) {
echo '<p>Sub-pages:</p>' . "\n";
echo '<ul>' . "\n";
foreach ($post_children as $child) {
//No home
if ($child->ID != get_option('page_on_front')) {
echo ' <li><a href="' . get_permalink($child->ID) . '">' . $child->post_title . '</a></li>' . "\n";
}
}
echo '</ul>' . "\n";
}
//Parent?
if ($post->post_parent) {
$ancestors = get_post_ancestors($post);
$parent_id = $ancestors[0];
echo '<p>Parent page:</p>' . "\n";
echo '<ul>' . "\n";
echo ' <li><a href="' . get_permalink($parent_id) . '">' . get_the_title($parent_id) . '</a></li>' . "\n";
echo '</ul>' . "\n";
}
//No Content
} else {
?>
<article id="not-found" <?php post_class();?>>
<?php echo do_shortcode('[Waymark file_url="' . get_template_directory_uri() . '/assets/geo/404.geojson"]'); ?>
</article>
<?php
}
?>
<?php get_footer();?>