-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpage-grid.php
109 lines (89 loc) · 3.08 KB
/
page-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
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
/**
* @package WordPress
* @subpackage skeleton
* Template Name: Page w/ Archive Grid
*/
?>
<?php include ("header.php") ?>
<!-- Begin Template: page-grid.php -->
<div id="content">
<div class="wrapper">
<div class="section full">
<div class="section full text nopadding">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1 class="pagetitle"><?php the_title(); ?></h1>
<?php the_content(__('')); ?>
<?php endwhile; else: endif; ?>
</div> <!-- END .section full text -->
<div class="section full posts grid <?=$meta['page_list_type'][0]?> <?=$meta['page_list_tag'][0]?> fourth">
<?php
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$ppp = get_option('posts_per_page');
if($meta['page_list_ppp'][0] != false) $ppp = $meta['page_list_ppp'][0];
$custom_args = array(
'post_type' => $meta['page_list_type'][0],
'posts_per_page' => -1,
'paged' => $paged
);
if($meta['page_list_tag'][0] != 'false'){
$custom_args['tax_query'] = array(
array(
'taxonomy' => 'resource_types',
'field' => 'slug',
'terms' => $meta['page_list_tag'][0]
),
);
}
$k = 1;
$i = 1;
$custom_query = new WP_Query( $custom_args ); ?>
<?php if ( $custom_query->have_posts() ) : ?>
<!-- the loop -->
<?php while ( $custom_query->have_posts() ) : $custom_query->the_post();
$perma = get_post_meta( $post->ID, 'resource_url', true );
if($perma == false){$perma = get_permalink($post->ID);}
$class = "post post".$i;
if($k==1){ $class .=" first"; }
if($k==4){ $class .=" last";}
?>
<div class="<?=$class?> ">
<div class='feat'>
<?php if ( has_post_thumbnail() ) {
echo "<a href='".$perma."' >";
the_post_thumbnail('resource');
echo '</a>';
}?></div>
<div class="content">
<h3><a href="<?=$perma ?>" ><?php the_title(); ?></a></h3>
<p><?php echo get_the_excerpt() ?></p>
<?php if($meta['page_list_button'][0]){?><a class="readmore button green" href="<?=$perma ?>"><?=$meta['page_list_button'][0]?></a><?php }?>
</div>
</div> <!--END post post<?=$i?> -->
<?php
$k++;
if($k > 4){$k=1;}
$i++;
endwhile; ?>
<!-- end of the loop -->
<!-- pagination here -->
<?php
if (function_exists(custom_pagination)) {
custom_pagination($custom_query->max_num_pages,"",$paged);
}
?>
<?php wp_reset_postdata(); ?>
<?php else: ?>
<p><?php _e( $meta['page_list_none'][0] ); ?></p>
<?php endif; ?>
</div> <!-- END .section full posts list -->
<?php if($meta['page_list_aftertext'][0]){ ?>
<div class="section full text">
<?php echo $meta['page_list_aftertext'][0] ?>
</div> <!-- END .section full text -->
<?php } ?>
</div>
</div> <!-- END .wrapper -->
</div> <!-- END #content -->
<!-- End Template: page-grid.php -->
<?php include ("footer.php") ?>