forked from MITLibraries/MITLibraries-news
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontent-single.php
84 lines (58 loc) · 2.1 KB
/
content-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
<?php
/**
* @package MIT Libraries News
*/
$category = get_the_category();
$type_post = get_post_type();
$subtitle;
$type;
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> data-category="<?php echo $category[0]->slug; ?>">
<div class="title-page mySingle">
<?php if (get_field('mark_as_new') === true): ?>
<span>New!</span>
<?php endif; ?>
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
<div class="entry-meta">
<span class="author">
By <?php the_author_posts_link(); ?>
</span>
<span class="date-post">
<?php echo ' on '; the_date(); ?>
</span>
<?php if(has_category()): ?>
<span class="category-post">
<?php
$category = get_the_category();
?>
<?php //echo ' in ' . array_slice($category, 0, 2); ?>
</span>
<?php endif; ?>
</div><!-- .entry-meta -->
</div><!-- .title-page -->
<div class="entry-content mitContent">
<?php
the_content();
// 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>';
} ?>
<?php
$date = DateTime::createFromFormat('Ymd', get_field('event_date'));
//echo $date->format('d-m-Y');
// Check for events
if ($type_post == 'post' && get_field('is_event') == 1) { ?>
<div class="event"><span class="grey">Event date </span> <?php echo $date->format('F, j Y'); ?><span class="grey"> starting at</span> <?php echo get_field('event_start_time'); ?> <span class="grey"><?php if(get_field('event_end_time') != ""){ ?> and ending at</span> <?php echo get_field('event_end_time'); }?></div>
<?php
}
?>
</div><!-- .entry-content -->
</article><!-- #post-## -->