forked from vanbexlabs/hackathon-wordpress-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
loop-event.php
88 lines (82 loc) · 2.67 KB
/
loop-event.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
<ul class="box-list full">
<?php while ( have_posts() ) : the_post();
setup_postdata($post);
$data = get_post_meta( $post->ID, 'ndoch', true );
$city = $data['ndoch_location'];
$state = $data['ndoch_state'];
$country = $data['ndoch_country'];
$venue_name = get_field('venue_name');
$venue_address = get_field('venue_address');
$venue_address2 = get_field('venue_address2');
$venue_city = get_field('venue_city');
$venue_zip = get_field('venue_zip');
$venue_map = get_field('venue_map');
$registration_url = get_field('registration_url');
$registration_url_check = substr($registration_url, 0, 4);
$start_date = DateTime::createFromFormat('Ymd', get_field('start_date'));
?>
<li>
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink() ?>" class="thumb">
<?php
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'post-thumbnail' );
echo '<img src="' . $thumb['0'] . '" alt="" />';
?>
</a>
<?php } ?>
<div class="box-content">
<h4><a href="<?php the_permalink() ?>">
<?php the_title(); ?>
<?php if (!empty($start_date)) {
echo '<span> ' . $start_date->format('l, F j, Y') . '</span>';
} ?>
</a></h4>
<p>
<?php
if (!empty($venue_name)) {
echo '<strong>' . $venue_name . '</strong> <br>';
}
if (!empty($venue_address)) {
echo $venue_address . ' <br>';
}
if (!empty($venue_address2)) {
echo $venue_address2 . ' <br>';
}
if (!empty($venue_city)) {
echo $venue_city . ' ';
} elseif (!empty($city)) {
echo $city . ' ';
}
if (!empty($state) && $state != 'N/A') {
echo $state . ' ';
}
if (!empty($venue_zip)) {
echo $venue_zip;
}
?>
</p>
</div>
<?php
if (!empty($registration_url)) {
if($registration_url_check !== 'http'){
echo '<a href="http://' . $registration_url . '" class="btn btn-clr">Register for this event</a>';
} else {
echo '<a href="' . $registration_url . '" class="btn btn-clr">Register for this event</a>';
}
} else {
echo '<a href="' . get_the_permalink() . '" class="btn btn-clr">View details</a>';
}
?>
</li>
<?php endwhile; ?>
</ul>
<?php if(function_exists('wp_paginate')) { ?>
<div class="pagination cf">
<?php wp_paginate(); ?>
</div>
<?php } else { ?>
<div class="pagination cf">
<div class="posts-nav older"><?php next_posts_link('Next <span>></span>', 0); ?></div>
<div class="posts-nav newer"><?php previous_posts_link('<span><</span> Previous', 0); ?></div>
</div>
<?php } ?>