forked from MITLibraries/MITLibraries-news
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharchive.php
159 lines (111 loc) · 4.01 KB
/
archive.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php
/**
* The template for displaying Archive pages.
* also bibliotech cat pages
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* If you'd like to further customize these archive views, you may create a
* new template file for each specific one. For example, Twenty Twelve already
* has tag.php for Tag archives, category.php for Category archives, and
* author.php for Author archives.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header();
$date = DateTime::createFromFormat('Ymd', get_field('event_date'));
?>
<?php get_template_part('inc/sub-header'); ?>
<?php
if((get_post_type( get_the_ID() ) == 'bibliotech') || (cat_is_ancestor_of(73, $cat) or is_category(73))){ ?>
<?php get_template_part('inc/bib-header'); ?>
<?php } ?>
<section id="" class="site-content">
<div id="content" role="main">
<?php if ( have_posts() ) : ?>
<!-- .archive-header -->
<div class="container">
<div class="row">
<?php
$i = -1;
while ( have_posts() ) : the_post();
$i++;
?>
<div class="<?php if ($i % 3 == 0){ echo "third "; } ?> col-xs-12 col-xs-B-6 col-sm-4 col-md-4 no-padding-left-mobile">
<div class="hentry flex-item blueTop eventsBox <?php if (get_field("listImg")) { echo "has-image";} else { echo "no-image"; } ?>" onClick='location.href="<?php if((get_field("external_link") != "") && $post->post_type == 'spotlights'){ the_field("external_link");}else{ echo get_post_permalink();} ?>"'>
<?php get_template_part('inc/spotlights'); ?>
<?php
if (get_field("listImg") != "" ) { ?>
<img data-original="<?php the_field("listImg") ?>" width="100%" height="111" class="img-responsive" alt="<?php the_title(); ?>"/>
<?php } ?>
<?php if($post->post_type == 'spotlights'){ ?>
<h2 class="entry-title title-post spotlights">
<a href="<?php the_field("external_link"); ?>"><?php the_title();?></a>
</h2>
<?php }else{ ?>
<h2 class="entry-title title-post">
<a href="<?php the_permalink(); ?>"><?php the_title();?></a>
</h2>
<?php } ?>
<?php get_template_part('inc/events'); ?>
<?php get_template_part('inc/entry'); ?>
<!--final **** else-->
<?php { ?>
<!--EVENT -->
<?php } ?>
<div class="category-post">
<?php
$category = get_the_category(); if($category[0]){
echo '<a title="'.$category[0]->cat_name.'" title="'.$category[0]->cat_name.'" href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'</a>';
}
?>
<span class="mitDate">
<time class="updated" datetime="<?php echo get_the_date(); ?>"> <?php echo get_the_date(); ?></time>
</span>
</div>
</div>
</div>
<!-- eventsBox -->
<?php endwhile; ?>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
</div>
<!-- MITContainer -->
</div><!--closes row-->
</div>
<!-- #content -->
</section>
<!-- #primary -->
<?php
if($i > 7){
get_template_part('inc/more-posts');
}
?>
</div>
<!-- wrap -->
<script>
$(document).ready(function() {
var offset = 11;
var limit = 9;
//$("#postContainer").load("/news/add-bibliotech-posts/");
$("#another").click(function(){
limit = limit+9;
offset = offset+11;
$("#postContainer")
//.slideUp()
.load("/news/more-archives/?offset="+offset+"&limit="+limit, function() {
//.load("/news/test/?offset="+offset, function() {
$(this).slideDown();
});
return false;
});
});
</script>
<div class="container">
<?php get_footer(); ?>