-
Notifications
You must be signed in to change notification settings - Fork 1
/
single-platform.php
180 lines (177 loc) · 7.14 KB
/
single-platform.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php get_header(); ?>
<?php latavelha_map('<a href="' . get_post_type_archive_link('platform') . '">' . __('Platforms', 'latavelha') . '</a>', false); ?>
<?php if(have_posts()) : the_post(); ?>
<section id="platform-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="container">
<div class="twelve columns">
<article class="platform-content">
<div class="seven columns alpha">
<div class="map-content-box <?php if(latavelha_is_platform_old()) echo 'old-stamp'; ?>">
<header class="platform-header header">
<div class="clearfix">
<h1><?php the_title(); ?></h1>
</div>
<div class="main-meta clearfix">
<?php
$owner = latavelha_get_platform_owner();
$operator = latavelha_get_platform_operator();
?>
<?php if($owner) : ?>
<p class="owner">
<a href="<?php echo get_term_link($owner, 'platform-owner'); ?>">
<span><?php _e('Owner', 'latavelha'); ?></span><?php echo $owner->name; ?>
</a>
</p>
<?php endif; ?>
<?php if($operator) : ?>
<p class="operator">
<a href="<?php echo get_term_link($operator, 'platform-operator'); ?>">
<span><?php _e('Operator', 'latavelha'); ?></span><?php echo $operator->name; ?>
</a>
</p>
<?php endif; ?>
</div>
</header>
<section class="platform-data main-section">
<?php if(latavelha_get_platform_status()) : ?>
<div class="platform-status clearfix">
<h3><?php _e('Current status', 'latavelha'); ?></h3>
<p class="status-title <?php echo latavelha_get_platform_status_class(); ?>"><?php echo latavelha_get_platform_status_name(); ?></p>
</div>
<?php endif; ?>
<div class="platform-data-table">
<?php
/* Grab all data */
$other_names = get_post_meta($post->ID, 'other_names', true);
$type = latavelha_get_platform_type();
$construction_date = get_post_meta($post->ID, 'construction_date', true);
$year = get_post_meta($post->ID, 'year', true);
$lat = get_post_meta($post->ID, 'geocode_latitude', true);
$lon = get_post_meta($post->ID, 'geocode_longitude', true);
?>
<table>
<tbody>
<?php if($other_names) : ?>
<tr>
<th><?php _e('Other names', 'latavelha'); ?></th>
<td><?php echo $other_names; ?></td>
</tr>
<?php endif ?>
<?php if($type) : ?>
<tr>
<th><?php _e('Platform type', 'latavelha'); ?></th>
<td><a href="<?php echo get_term_link($type, 'platform-type'); ?>"><?php echo $type->name; ?></a></td>
</tr>
<?php endif; ?>
<?php if($construction_date) : ?>
<tr class="year">
<th><?php _e('Construction year', 'latavelha'); ?></th>
<td><?php echo $construction_date; ?></td>
</tr>
<tr class="age">
<th><?php _e('Age', 'latavelha'); ?></th>
<td><?php echo latavelha_get_platform_age_text(); ?></td>
</tr>
<?php endif ?>
<?php if($year) : ?>
<tr>
<th><?php _e('Year', 'latavelha'); ?></th>
<td><?php echo $year; ?></td>
</tr>
<?php endif ?>
<?php if($lat) : ?>
<tr>
<th><?php _e('Latitude', 'latavelha'); ?></th>
<td><?php echo $lat; ?></td>
</tr>
<?php endif ?>
<?php if($lon) : ?>
<tr>
<th><?php _e('Longitude', 'latavelha'); ?></th>
<td><?php echo $lon; ?></td>
</tr>
<?php endif ?>
</tbody>
</table>
</div>
</section>
</div>
<section class="below-content">
<?php the_content(); ?>
</section>
</div>
<div class="four columns omega offset-by-one">
<aside class="related-content">
<?php
$args = latavelha_get_platform_related_args(array('posts_per_page' => 2));
query_posts($args);
if(have_posts()) : ?>
<div class="news">
<h2><?php _e('News', 'latavelha'); ?></h2>
<?php get_template_part('loop', 'post'); ?>
</div>
<?php endif; ?>
<?php wp_reset_query(); ?>
<div class="links">
<h2><?php _e('Links', 'latavelha'); ?></h2>
<?php
/* Grab all links */
$local = get_post_meta($post->ID, 'platform_link_local', true);
$rigzone = get_post_meta($post->ID, 'platform_link_rigzone', true);
$marinetraffic = get_post_meta($post->ID, 'platform_link_marinetraffic', true);
$site = get_post_meta($post->ID, 'platform_link_site', true);
?>
<ul>
<?php if($local) : ?>
<li>
<h3><a href="<?php echo $local; ?>" target="_blank" rel="external">Local</a></h3>
</li>
<?php endif; ?>
<?php if($rigzone) : ?>
<li>
<h3><a href="<?php echo $rigzone; ?>" target="_blank" rel="external">Rigzone</a></h3>
</li>
<?php endif; ?>
<?php if($marinetraffic) : ?>
<li>
<h3><a href="<?php echo $marinetraffic; ?>" target="_blank" rel="external">Marine Traffic</a></h3>
</li>
<?php endif; ?>
<?php if($site) : ?>
<li>
<h3><a href="<?php echo $site; ?>" target="_blank" rel="external">Website</a></h3>
</li>
<?php endif; ?>
</ul>
</div>
</aside>
<aside class="social">
<div class="facebook">
<iframe src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&send=false&layout=box_count&width=60&show_faces=false&font=verdana&colorscheme=light&action=like&height=90&appId=521681297871040" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width: 60px; height:90px;" allowTransparency="true"></iframe>
</div>
<div class="twitter">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php the_permalink(); ?>" data-lang="en" data-count="vertical">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
</aside>
</div>
<?php
/* Accidents query */
$args = latavelha_get_platform_related_args(array('posts_per_page'=>-1,'post_type'=>'accident'));
query_posts($args);
if(have_posts()) : ?>
<section class="accidents single-section clearfix">
<div class="twelve columns alpha omega">
<h2><?php _e('Accidents', 'latavelha'); ?></h2>
<?php get_template_part('loop', 'accident'); ?>
</div>
</section>
<?php endif; ?>
<?php wp_reset_query(); ?>
<?php get_template_part('section', 'attachments'); ?>
</article>
</div>
</div>
</section>
<?php endif; ?>
<?php get_footer(); ?>