-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcontent-single.php
More file actions
82 lines (61 loc) · 2.08 KB
/
Copy pathcontent-single.php
File metadata and controls
82 lines (61 loc) · 2.08 KB
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
<?php
/**
* The template for displaying content of a single post.
*
* @package MITLibraries-News
* @since 1.0.0
*/
$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();
?>
</span>
<?php endif; ?>
</div><!-- .entry-meta -->
</div><!-- .title-page -->
<div class="entry-content mitContent">
<?php
the_content();
// Echo type of Feature, if Feature.
if ( 'features' === $type_post ) {
$type = get_field( 'feature_type' );
echo 'The feature type is' . $type;
}
// Echo start/end dates, if they exist.
if ( 'exhibits' === $type_post || 'updates' === $type_post ) {
$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 ( 'post' == $type_post && 1 == get_field( 'is_event' ) ) { ?>
<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-## -->