-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathadditionalPosts.php
More file actions
88 lines (68 loc) · 1.57 KB
/
additionalPosts.php
File metadata and controls
88 lines (68 loc) · 1.57 KB
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
<?php
/**
* This template loads additional Posts if any exist from the homepage.
* Template Name: Additional Posts
*
* @package MITLibraries-News
* @since 1.0
*/
?>
<script type="text/javascript">
$(document).ready(function() {
$("img.img-responsive").lazyload({
effect : "fadeIn",
effectspeed: 450 ,
failure_limit: 999999
});
});
</script>
<?php
$date = DateTime::createFromFormat( 'Ymd', get_field( 'event_date' ) );
?>
<?php
$offset = htmlspecialchars( trim( $_GET['offset'] ) );
if ( '' == $offset ) {
$offset = 9;
}
$limit = htmlspecialchars( trim( $_GET['limit'] ) );
if ( '' == $limit ) {
$limit = 9;
}
$args = array(
'posts_per_page' => $limit,
'post_type' => array( 'spotlights','bibliotech', 'post' ),
'offset' => $offset,
'post__not_in' => get_option( 'sticky_posts' ),
'ignore_sticky_posts' => 1,
'orderby' => 'date',
'order' => 'DESC',
'suppress_filters' => false,
);
$the_query = new WP_Query( $args );
?>
<?php
// Removes button start.
$ajaxLength = $the_query->post_count;
?>
<?php if ( $ajaxLength < $limit ) { ?>
<script>
$("#another").hide();
</script>
<?php }
// Removes button end. ?>
<?php if ( $the_query->have_posts() ) : ?>
<?php
$o = -1;
while ( $the_query->have_posts() ) : $the_query->the_post();
renderRegularCard( $o, $post );
$o++;
?>
<?php if ( get_post_type( get_the_ID() ) == 'bibliotech' ) { ?>
</div>
<!--close div that opens in bilbio if statement-->
<?php } ?>
<?php
endwhile;
else :
endif;
wp_reset_query(); // Restore global post data stomped by the_post(). ?>