-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-apps-by-date.php
140 lines (113 loc) · 3.02 KB
/
template-apps-by-date.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
/**
* Template Name: By Date
*/
?>
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('templates/page', 'header'); ?>
<h5>Released within the last 30 days</h5>
<h6>Read all descriptions carefully, buyer beware. Please see the <a href="/apps">app homepage</a> for info about how we track these apps.</h6>
<br>
<ul class="tax-page-ul">
<?php
$thrity_days_ago = strtotime('-30 days');
$comparision_date = date(DATE_ATOM);
?>
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'post_type' => 'apps',
'posts_per_page' => '102',
'order' => 'ASC',
'meta_key' => 'current_version_release_date',
'orderby' => 'meta_value',
'paged' => $paged,
'meta_query' => array(
array(
'key' => 'current_version_release_date',
'value' => $comparision_date,
'compare' => '<',
),
),
);
// the query
$the_query = new WP_Query( $args ); ?>
<?php if ( $the_query->have_posts() ) : ?>
<!-- pagination here -->
<!-- the loop -->
<ul class="tax-page-ul">
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php
$url = wp_get_attachment_url( get_post_thumbnail_id($id) );
$sizes = get_intermediate_image_sizes();
$images = array();
foreach ( $sizes as $size ) {
$images[] = wp_get_attachment_image_src( get_post_thumbnail_id($id), $size );
}
?>
<li>
<a href="<?php the_permalink(); ?>">
<img src="<?php
if ($images[0][0] == false ) {
echo '/wp-content/uploads/STR/genericPostPhoto.png';
}
else {
echo $images[0][0];
}
?>" />
<?php
if (has_term('Version Update', 'status')) {
if ( has_term('Price Drop', 'status') ) {
echo '<div class="app-sticky green version-update">';
}
else if ( has_term('Price Bump', 'status') ) {
echo '<div class="app-sticky red version-update">';
}
else {
echo '<div class="app-sticky version-update">';
}
}
else {
if ( has_term('Price Drop', 'status') ) {
echo '<div class="app-sticky green">';
}
else if ( has_term('Price Bump', 'status') ) {
echo '<div class="app-sticky red">';
}
else {
echo '<div class="app-sticky">';
}
}
?>
<?php
$price = get_field('price');
if ( $price == '0' ) {
echo 'FREE';
}
else {
echo '$';
echo $price;
}
?>
</div>
<?php the_title(); ?>
</a>
</li>
<?php endwhile; ?>
</ul>
<!-- end of the loop -->
<?php if(function_exists('wp_pagenavi')) { // if PageNavi is activated ?>
<?php wp_pagenavi( array( 'query' => $the_query ) ); // Use PageNavi ?>
<?php } else { // Otherwise, use traditional Navigation ?>
<div class="nav-previous">
<!-- next_post_link -->
</div>
<div class="nav-next">
<!-- previous_post_link -->
</div>
<?php } // End if-else statement ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
<?php endwhile; ?>