-
Notifications
You must be signed in to change notification settings - Fork 0
/
grid.php
96 lines (73 loc) · 2.84 KB
/
grid.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
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
* Template Name: Grid Template
*
* The template for displaying grid based templates.
*
* @package WordPress
* @subpackage Palmetto
* @since Palmetto 0.1
*/
get_header(); ?>
<?php
// Start the loop.
while ( have_posts() ) : the_post();
// Include the page content template.
get_template_part( 'template-parts/content', 'page' );
// Get subpages
$subpages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) );
$counter = 0;
if ($subpages) { ?>
<div class="row medium-unstack" data-equalizer>
<?php
foreach( $subpages as $page ) {
$thumb_id = get_post_thumbnail_id($page->ID);
$thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail-size', true);
$thumb_url = $thumb_url_array[0];
$listing_placeholder_image= get_theme_mod( 'listing_placeholder_image', '' );
if ($counter % 3 == 0) { ?>
</div> <!-- end row -->
<div class="row" data-equalizer style="margin-top:20px;">
<?php }
?>
<div class="large-4 columns <?php if ( ($counter + 1) == sizeof($subpages)) { echo "end";} ?>">
<div class="listing-box" data-equalizer-watch>
<div class="listing-image">
<a href="<?php echo get_page_link( $page->ID ); ?>">
<?php if ($thumb_url && strpos($thumb_url,'default') === false) { ?>
<img src="<?php echo $thumb_url; ?>" />
<?php } elseif ($listing_placeholder_image) { ?>
<img src="<?php echo $listing_placeholder_image; ?>" />
<?php } else { ?>
<img src="<?php echo get_template_directory_uri() . '/assets/img/dft-placeholder-listing.jpg'; ?>" />
<?php } ?>
</a>
</div> <!-- listing image -->
<div class="listing-text">
<h4><a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?></a></h4>
<p><?php echo $page->post_excerpt;?></p><p class="text-center">
<a class="button text-center" href="<?php echo get_page_link( $page->ID ); ?>">View Listing</a></p>
</div> <!-- listing text -->
</div> <!-- listing box -->
</div> <!-- subpage column -->
<?php
$counter++;
} // foreach
} // if
?>
</div> <!-- row -->
<?php
$content = $page->post_content;
$content = apply_filters( 'the_content', $content );
?>
<div class="row">
<?php
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
comments_template();
}
// End of the loop.
endwhile;
?>
</div> <!-- row -->
<?php get_footer(); ?>