forked from MITLibraries/MITLibraries-news
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
137 lines (104 loc) · 3.94 KB
/
index.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
<?php
$pageRoot = getRoot( $post );
$section = get_post( $pageRoot );
$isRoot = $section->ID == $post->ID;
get_header();
get_template_part( 'inc/sub-header' );
$sticky = get_option( 'sticky_posts' );
$args = array(
'posts_per_page' => 1,
'post__in' => $sticky,
'ignore_sticky_posts' => 1,
'orderby' => 'menu_order',
'order' => 'DESC',
'suppress_filters' => false
);
$query2 = new WP_Query( $args );
if ( $query2->have_posts() ):
while ( $query2->have_posts() ):
$query2->the_post();
if ( isset( $sticky[0] ) ) {
?>
<!-- OPEN CONTAINER FOR MOBILE/STICKY CARD LAYOUT -->
<div class="container container-fluid">
<!-- OPEN ROW FOR MOBILE/STICKY CARD LAYOUT -->
<div class="row">
<!-- CALLS MOBILE CARDS -->
<?php renderMobileCard( $i, $post ); ?>
<!-- CALLS STICKY CARDS -->
<?php renderFeatureCard( $i, $post ); ?>
<!-- RESETS QUERY -->
<?php wp_reset_postdata(); ?>
<?php wp_reset_query(); ?>
<?php } //isset( $sticky[0] ) ?>
<?php endwhile; ?>
<?php endif; ?>
<!-- CLOSES CALLS/QUERIES FOR MOBILE/STICKY CARDS -->
<!-- OPEN CONTAINER FOR REGULAR CARD LAYOUT -->
<div class="container container-fluid">
<!-- OPEN ROW FOR REGULAR CARD LAYOUT -->
<div class="row">
<?php
$args = array(
'posts_per_page' => 9,
'post_type' => array(
'spotlights',
'bibliotech',
'post'
),
'post__not_in' => get_option( 'sticky_posts' ),
'ignore_sticky_posts' => 1,
'orderby' => 'post_date',
'order' => 'DESC',
'suppress_filters' => false
);
$the_query = new WP_Query( $args );
?>
<?php
if ( $the_query->have_posts() ):
// $theLength = $count_posts->publish;
?>
<?php
$i = -1;
while ( $the_query->have_posts() ):
$the_query->the_post();
$i++;
renderRegularCard( $i, $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; ?>
</div>
<!--closes ROW-->
</div>
<!--closes NEWS-CONTAINER-->
<?php
if ( $i > 6 ) {
get_template_part( 'inc/more-posts' );
} //$i > 6
?>
</div>
<script>
$(document).ready(function() {
var offset = 9;
var limit = 9;
$("#postContainer").load("/news/test/");
$("#another").click(function(){
limit = limit+9;
offset = offset+9;
$("#postContainer")
//.slideUp()
.load("/news/test/?offset="+offset+"&limit="+limit, function() {
//.load("/news/test/?offset="+offset, function() {
$(this).slideDown();
});
return false;
});
});
</script>
<div class="container container-fluid">
<?php
get_footer();
?>