-
Notifications
You must be signed in to change notification settings - Fork 0
/
card-mini.php
65 lines (52 loc) · 1.63 KB
/
card-mini.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
<?php
// Prepare data for use in template.
$card = get_the_occupy_sandy_card();
if (is_wp_error($card)) :
?>
<div class="card error <?php print $card->get_error_code(); ?>">
<h5 class="cardType">Back-End Error</h5>
<p><?php print $card->get_error_message(); ?></p>
</div>
<?php
else :
$classes = array('card', $card->get_card_class());
$state = $card->get_state();
$address = $card->get_address();
$timestamp = $card->get_timestamp('U');
$status = $card->get_status();
$times = $card->get_times();
$contact = $card->get_contact();
$link = $card->get_link(); // Is this supposed to be a URL or HTML? I'm assuming HTML for now.
$description = $card->get_description();
// Pretty-print the date.
$today = time(); $yesterday = time() - (24*3600);
if (is_numeric($timestamp)) :
$datestamp = date('Y-m-d', $timestamp);
if (date('Y-m-d', $today) == $datestamp) :
$updated = 'today ';
elseif (date('Y-m-d', $yesterday) == $datestamp) :
$updated = 'yesterday ';
else :
$updated = date('M j, ', $timestamp);
endif;
$updated .= date('ga', $timestamp);
else :
$updated = $timestamp;
endif;
?>
<div class="<?php print implode(" ", $classes); ?> mini">
<a href="<?php print $link; ?>" class="aCard">
<?php if (strlen($link) > 0) : ?>
<h5 class="cardLink pictogram">➦</h5>
<?php endif; ?>
<h2 class="cardName"><?php print $card->get_title(); ?></h2>
<?php if (strlen($status) > 0) : ?>
<p class="cardStatus"><?php print $status; ?>…</p>
<?php endif; ?>
<?php if (strlen($updated) > 0) : ?>
<h5 class="cardUpdated">Updated <?php print $updated; ?></h5>
<?php endif; ?>
</a>
</div>
<?php
endif;