forked from MITLibraries/MITLibraries-news
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadditionalPosts-cat.php
90 lines (60 loc) · 1.65 KB
/
additionalPosts-cat.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
<script>
$(function() {
$("img.img-responsive").lazyload({
effect : "fadeIn",
effectspeed: 450 ,
failure_limit: 999999
});
});
</script>
<?php
$date = DateTime::createFromFormat('Ymd', get_field('event_date'));
?>
<?php
/*
Template Name: Additional Posts Cats
*/
global $post;
$categoryId = $_GET['categoryID'];
$offset = htmlspecialchars(trim($_GET['offset']));
if ($offset == '') {
$offset = 21;
}
$limit = htmlspecialchars(trim($_GET['limit']));
if ($limit == '') {
$limit = 9;
}
$args = array(
'posts_per_page' => $limit,
'post_type' => 'post',
'cat' => $categoryId ,
'offset' => 21,
'post__not_in' => get_option( 'sticky_posts' ),
'ignore_sticky_posts' => 1,
'orderby' => 'date',
'order' => 'DESC',
'suppress_filters' => false
);
$the_query = new WP_Query($args);
//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();
$o++;
renderRegularCard( $o, $post ); // --- CALLS REGULAR CARDS --- //
?>
<?php if ( get_post_type( get_the_ID() ) == 'bibliotech' ) { ?>
<?php } //get_post_type( get_the_ID() ) == 'bibliotech' ?>
<?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>
<?php endwhile; ?>
<?php endif; ?>