-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpage.php
71 lines (51 loc) · 1.56 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
<?php get_header(); ?>
<section class="main-column">
<?php while(have_posts()) : the_post(); ?>
<article class="post" id="<?php the_ID(); ?>">
<header>
<h1 class="post-title"><?php the_title(); ?></h1>
<div class="excerpt">
<?php the_excerpt(); ?>
</div>
</header>
<section class="entry clearfix">
<?php the_content(); ?>
</section>
<footer>
<?php wp_link_pages(); ?>
<div class="meta-column clearfix" id="post-meta">
<span class="meta-title">Meta:</span> <?php the_meta(); ?>
</div>
<div class="page-level clearfix">
<?php
if($post->post_parent){
$relations = get_post_ancestors($post->ID);
$result = $wpdb->get_results( "SELECT ID FROM wp_posts WHERE post_parent = $post->ID AND post_type='page'" );
if ($result){
foreach($result as $pageID){
array_push($relations, $pageID->ID);
}
}
array_push($relations, $post->ID);
$relations_string = implode(",",$relations);
$sidelinks = wp_list_pages("title_li=&echo=0&include=".$relations_string);
}else{
$sidelinks = wp_list_pages("title_li=&echo=0&depth=1&child_of=".$post->ID);
}
if ($sidelinks) { ?>
<h2><?php the_title(); ?></h2>
<ul>
<?php //links in <li> tags
echo $sidelinks; ?>
</ul>
<?php } ?>
</div>
</footer>
</article> <!-- .post -->
<div id="comment-area">
<?php comments_template(); ?>
</div>
<?php endwhile; ?>
</section>
<?php get_sidebar(); ?>
<?php get_footer(); ?>