forked from MITLibraries/MITLibraries-news
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsingle.php
208 lines (183 loc) · 7.19 KB
/
single.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<?php
/**
* The template for displaying all single posts.
*
* @package MIT Libraries News
*/
get_header();
$category = get_the_category();
$type_post = get_post_type();
$subtitle;
$type;
?>
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=mitlib" async="async"></script>
<?php get_template_part('inc/sub-headerSingle'); ?>
<?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 } ?>
<div class="container">
<div id="primary" class="content-area">
<main id="main" class="content-main" role="main">
<div class="row">
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> data-category="<?php echo $category[0]->slug; ?>">
<div class="title-page mySingle">
<?php the_title( '<h1 class="entry-title single">', '</h1>' ); ?>
<?php if (get_field("subtitle")){ ?>
<h2 class="subtitle"><?php the_field("subtitle"); ?></h2>
<?php } ?>
<div class="entry-meta"> <span class="author"> By
<?php
if (get_field("pauthor")){
the_field("pauthor");
}elseif (get_field("bauthor")){
the_field("bauthor");
}else{
the_author_posts_link();
}
?>
</span> <span class="date-post"> <?php echo ' on '; the_date(); ?> </span>
<?php if(has_category()): ?>
<span class="category-post-single"> in
<?php
$category = get_the_category();
?>
<?php
$rCat = count($category);
$r = rand(0, $rCat -1);
echo '<a title="'.$category[$r]->cat_name.'" title="'.$category[$r]->cat_name.'" href="'.get_category_link($category[$r]->term_id ).'">'.$category[$r]->cat_name.'</a>';
?>
<?php //echo ' in ' . array_slice($category, 0, 2); ?>
</span>
<?php endif; ?>
</div>
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<div class="addthis_sharing_toolbox"></div>
<div class="clearfix"></div>
<!-- .entry-meta -->
</div>
<!-- .title-page -->
<div class="entry-content inlineHeader mitContent clearfix">
<?php if(get_field('event_date')){
$date = DateTime::createFromFormat('Ymd', get_field('event_date'));
?>
<!--EVENT -->
<div class="single-page events">
<span class="gray">Event date</span><span class="bg-image"><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="15px" height="15px" x="0px" y="0px"
viewBox="-299 390 13 13" style="enable-background:new -299 390 13 13;" xml:space="preserve">
<style type="text/css">
.st0{fill:#F58632;}
</style>
<g>
<g id="XMLID_9_">
<path id="XMLID_35_" class="st0" d="M-286.9,393.7v-0.8c0-0.4-0.4-0.8-0.8-0.8h-0.8v-0.8c0-0.4-0.4-0.8-0.8-0.8
c-0.4,0-0.8,0.4-0.8,0.8v0.8h-4.8v-0.8c0-0.4-0.4-0.8-0.8-0.8c-0.4,0-0.8,0.4-0.8,0.8v0.8h-0.8c-0.4,0-0.8,0.4-0.8,0.8v0.8
C-298.1,393.7-286.9,393.7-286.9,393.7z"/>
</g>
<g>
<path id="XMLID_76_" class="st0" d="M-298.1,394.5v7.2c0,0.4,0.4,0.8,0.8,0.8h9.6c0.4,0,0.8-0.4,0.8-0.8v-7.2H-298.1z
M-294.9,400.9h-1.6v-1.6h1.6V400.9z M-294.9,397.7h-1.6v-1.6h1.6V397.7z M-291.7,400.9h-1.6v-1.6h1.6
C-291.7,399.3-291.7,400.9-291.7,400.9z M-291.7,397.7h-1.6v-1.6h1.6C-291.7,396.1-291.7,397.7-291.7,397.7z M-288.5,400.9h-1.6
v-1.6h1.6V400.9z M-288.5,397.7h-1.6v-1.6h1.6V397.7z"/>
</g>
</g>
</svg></span>
<span class="event"><?php echo $date->format('F j, Y'); ?></span>
<span class="time">
<?php if( get_field('event_start_time') ){
echo the_field('event_start_time');
} ?>
<?php if(( get_field('event_start_time') ) && ( get_field('event_end_time') )){
echo '-';
} ?>
<?php if( get_field('event_end_time') ){
echo the_field('event_end_time');
} ?>
</span>
</div>
<?php } ?>
<!--=================image=================== -->
<?php if (get_field('image')){ ?>
<div class="mySinglePicMobile hidden-md hidden-lg col-xs-12">
<img data-original="<?php echo get_field('image');?> "width="100%" alt="<?php the_title(); ?>" class="thumbnail img-responsive" />
<?php if(get_field("caption")){ ?>
<div class="mitCaption"><?php the_field("caption"); ?></div>
<?php } ?>
</div>
<?php } ?>
<!--=================image=================== -->
<!--=================image=================== -->
<?php if (get_field('image')){ ?>
<div class="mySinglePic hidden-sm hidden-xs">
<img data-original="<?php echo get_field('image');?> "width="679" alt="<?php the_title(); ?>" class="thumbnail img-responsive" />
<?php if(get_field("caption")){ ?>
<div class="mitCaption"><?php the_field("caption"); ?></div>
<?php } ?>
</div>
<?php } ?>
<!--=================image=================== -->
<?php the_content(); ?>
<?php
// Echo type of Feature, if Feature
if ($type_post === 'features') {
$type = get_field('feature_type');
echo 'The feature type is' . $type;
}
// Echo start/end dates, if they exist
if ($type_post === 'exhibits' || $type_post === 'updates') {
$date_start = get_field('date_start');
$date_end = get_field('date_end');
echo '<div>Start date is ' . $date_start . '</div>';
echo '<div>End date is ' . $date_end . '</div>';
} ?>
</div>
<!-- .entry-content -->
</div> <!--close row-->
</div><!--closes container that is open in the header to allow for the grey box fof the more in section -->
</article>
</div><!--trying to break that container-->
<div style="background-color:rgb(233, 233, 233);padding-bottom:28px;border-top:4px solid rgb(224,224,224)">
<div class="container">
<div class="row singleMargin">
<div class="text-center moreIn"> More in <span class="lowercase"> <?php echo '<a title="'.$category[$r]->cat_name.'" title="'.$category[$r]->cat_name.'" href="'.get_category_link($category[$r]->term_id ).'">'.$category[$r]->cat_name.'</a>'; ?></span>
</div>
</div>
<?php wp_reset_postdata(); ?>
<?php wp_reset_query(); ?>
<?php endwhile; // end of the loop. ?>
<?php //get_template_part('inc/related'); ?>
<?php
$catName = $category[$r]->cat_name;
$currentPost = get_the_ID();
$myCatId = $category[$r]->cat_ID;
$args = array(
'post_type' => array( 'post', 'bibliotech', 'spotlights'),
'cat' => $myCatId,
'posts_per_page' => '3',
'order' => 'DESC',
'orderby' => 'date',
'post__not_in' => array($currentPost),
);
?>
<div class="row">
<?php
$myposts = get_posts($args);
$y = 1 ;
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
<?php //echo $GLOBALS['wp_query']->request; ?>
<?php renderRegularCard( $i, $post ); // --- CALLS REGULAR CARDS --- // ?>
<?php
$y = $y + 1;
endforeach;
wp_reset_postdata();?>
</div>
</main>
<!-- #main -->
</div>
<!-- #primary -->
</div><!--greybackground 100% width-->
<div style="background-color:rgb(233, 233, 233);">
<div class="container">
<?php get_footer(); ?>