-
Notifications
You must be signed in to change notification settings - Fork 0
/
card-max.php
77 lines (62 loc) · 2.16 KB
/
card-max.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
<?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); ?> max">
<h5 class="cardType"><?php print $card->get_card_heading(); ?></h5>
<?php if (strlen($address) > 0) : ?>
<h5 class="cardAddress"><?php print $address; ?></h5>
<?php endif; ?>
<?php if (strlen($updated) > 0) : ?>
<h5 class="cardUpdated">Updated <?php print $updated; ?></h5>
<?php endif; ?>
<?php if (strlen($status) > 0) : ?>
<p class="cardStatus"><span>Status:</span> <?php print $status; ?></p>
<?php endif; ?>
<p class="cardShip">You can ship items right now through our wedding registries!
<a class="button" href="http://interoccupy.net/occupysandy/wedding-registries/">Sandy's Wedding Registries</a>
</p>
<?php if (strlen($description) > 0) : ?>
<p class="cardDetails"><span>Details:</span> <?php print $description; ?></p>
<?php endif; ?>
<?php if (strlen($times) > 0) : ?>
<h5 class="cardTimes"><span>Times:</span> <?php print $times; ?></h5>
<?php endif; ?>
<?php if (strlen($contact) > 0) : ?>
<h5 class="cardContact"><span>Contact:</span> <?php print $contact; ?></h5>
<?php endif; ?>
</div>
<?php
endif;