-
Notifications
You must be signed in to change notification settings - Fork 4
/
page-section-landing.php
68 lines (65 loc) · 2.43 KB
/
page-section-landing.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
<?php
/*
Template Name: Section landing
*/
get_header(); ?>
<?php get_template_part( 'breadcrumb' ); ?>
<main id="primary" role="main" class="content-area level-two">
<div class="container">
<?php while ( have_posts() ) : the_post(); ?>
<div class="row">
<div class="col-md-12">
<div class="level-two-intro">
<?php
global $post;
$image = make_path_relative_no_pre_path( get_feature_image_url( $post->ID, 'feature-box-thumb' ) );
$title = get_the_title();
$content = wpautop(get_the_content());
$section_content = wpautop(get_post_meta( $post->ID, 'feat_box', true ));
get_page_banner( 'section', $title, $image, $content, '', '', $section_content );
?>
</div>
</div>
</div>
<div class="row equal-heights">
<?php
$i = 1;
$n = 1;
$boxes = array();
$id = is_front_page() ? 0 : $post->ID;
$pages = get_pages( array(
'sort_order' => 'asc',
'sort_column' => 'menu_order',
'exclude' => array( $post->ID ),
'child_of' => $id,
'parent' => $id,
) );
foreach ( $pages as $page ) {
$redirect = get_post_meta( $page->ID, 'redirectUrl', true );
$boxes[ $i ]['title'] = $page->post_title;
$boxes[ $i ]['url'] = ( $redirect ) ? $redirect : make_path_relative( get_page_link( $page->ID ) );
$boxes[ $i ]['image'] = make_path_relative_no_pre_path( get_feature_image_url( $page->ID, 'landing-page-children-thumb' ) );
$boxes[ $i ]['excerpt'] = ( $page->post_excerpt ) ? $page->post_excerpt : first_sentence( $page->post_content );
$child_pages = get_pages( array(
'sort_order' => 'asc',
'sort_column' => 'menu_order',
'child_of' => $page->ID,
'parent' => $page->ID
) );
if ( $child_pages ) {
foreach ( $child_pages as $child_page ) {
$redirect = get_post_meta( $child_page->ID, 'redirectUrl', true );
$boxes[ $i ]['child_pages'][ $n ]['title'] = $child_page->post_title;
$boxes[ $i ]['child_pages'][ $n ]['url'] = ( $redirect ) ? $redirect : make_path_relative( get_page_link( $child_page->ID ) );
$n ++;
}
}
$i ++;
}
get_content_children_boxes( $boxes );
?>
</div>
<?php endwhile; ?>
</div>
</main>
<?php get_footer(); ?>