-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-index.php
84 lines (60 loc) · 3.19 KB
/
page-index.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
83
84
<?php /* Template Name: Page Index */ ?>
<?php
get_header();
if ( have_posts() ) : while ( have_posts() ) : the_post();
?>
<section class="page-index">
<?php
$args = array(
'post_type' => 'page',
'posts_per_page' => -1,
'post_parent' => $post->ID,
'order' => 'ASC',
'orderby' => 'menu_order',
'post_status' => array('publish', 'private')
);
$parent = new WP_Query( $args );
?>
<header class="cover">
<div class="cover-content">
<h1>
<span><?php echo get_field('label'); ?></span>
<?php the_title(); ?>
</h1>
<?php the_content(); ?>
</div>
</header>
<div class="content" id="content">
<?php if ( $parent->have_posts() ) : ?>
<?php
while ( $parent->have_posts() ) : $parent->the_post();
// Make part from page child order
$page_order = $post->menu_order;
$part = 'Part ' . ($page_order + 1);
//$post_label = get_post_meta( $post->ID, 'label_meta', 1);
$post_cover_text = get_the_excerpt();
$post_image_url = wp_get_attachment_image_url( get_post_thumbnail_id(), 'large');
$post_image = get_the_post_thumbnail( $post , 'thumbnail');
if (get_post_status() == 'private') {
$post_wip = 'wip';
} else {
$post_wip = '';
}
?>
<article class="featured-post <?php echo $post_wip; ?>">
<header>
<label><?php echo $part; ?></label>
<h1><?php echo get_the_title(); ?></h1>
<span class="date"><?php echo get_the_date( 'F d, Y' ); ?></span>
<!--<span class="readtime" id="time"></span> min read-->
<?php if ($post_cover_text != '') { echo '<p>'.$post_cover_text.'</p>'; } ?>
<a href="<?php the_permalink(); ?>" class="button black" title="<?php the_title(); ?>">Read</a>
</header>
<figure style="background-image:url(<?php echo esc_url( $post_image_url ); ?>);"><?php echo $post_image; ?></figure>
</article>
<?php endwhile; ?>
<?php endif; wp_reset_postdata(); ?>
</div>
</section>
<?php endwhile; endif; ?>
<?php get_footer(); ?>