-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworks-single.php
More file actions
262 lines (233 loc) · 10 KB
/
works-single.php
File metadata and controls
262 lines (233 loc) · 10 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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<?php
if (have_posts()) {
the_post();
} elseif (wp_verify_nonce($_REQUEST['token'], "wp_token")) {
$post = get_post($_REQUEST['id']);
setup_postdata($post);
}
// AJAX TOKEN
$token = wp_create_nonce("wp_token");
$prev_post = getNextBack('prev', 'works', $post->menu_order, $post->post_date);
$next_post = getNextBack('next', 'works', $post->menu_order, $post->post_date);
?>
<div id="singlecontent">
<div class="columns navibg border-color">
<div class="four columns alpha">
<h3><a href="<?php echo get_home_url(); ?>"><i
class="fa fa-arrow-left"></i><?php _e('Works', 'dronetv'); ?></a>
</h3>
</div>
<div class="twelve columns omega">
<div class="navigate">
<hr class="resshow border-color" />
<span class="pname"></span>
<?php if (!empty($prev_post['ID'])) { ?>
<a href="<?php echo get_permalink($prev_post['ID']); ?>"
data-type="works" data-token="<?php echo $token?>"
data-id="<?php echo $prev_post['ID']?>"
title="<?php echo htmlspecialchars($prev_post['post_title'])?>"
class="navigate back getworks-nextback getworks-showmsg"><i class="fa fa-angle-left"></i></a>
<?php } ?>
<?php if (!empty($next_post['ID'])) { ?>
<a href="<?php echo get_permalink($next_post['ID']); ?>"
data-type="works" data-token="<?php echo $token?>"
data-id="<?php echo $next_post['ID']?>"
title="<?php echo htmlspecialchars($next_post['post_title'])?>"
class="navigate next getworks-nextback getworks-showmsg"><i class="fa fa-angle-right"></i></a>
<?php } ?>
</div>
</div>
</div>
<?php
$permalink = get_permalink($post->ID);
$work_media = unserialize(get_post_meta($post->ID, 'work-media', true));
$work_client = get_post_meta($post->ID, 'work-client', true);
$work_url = get_post_meta($post->ID, 'work-url', true);
$work_date = date('M jS, Y', strtotime(get_post_meta($post->ID, 'work-date', true)));
$terms = get_the_terms($post->ID, 'works-categories', 'string');
$descpos = get_post_meta($post->ID, 'work-desc-position', true);
if ($terms && ! is_wp_error($terms)) {
$draught_links = array();
foreach ($terms as $term) {
$draught_links[] = '<a href="'.esc_attr(get_term_link($term, 'works-categories')).'">'.$term->name.'</a>';
}
$categories = join(", ", $draught_links);
}
$topSection = [];
if (isset($categories) && $categories != "") {
$topSection['cats'] = true;
}
if (isset($work_client) && $work_client != "") {
$topSection['client'] = true;
}
if (isset($work_url) && $work_url != "") {
$topSection['url'] = true;
}
if(get_post_meta($post->ID, 'work-date', true)) {
$topSection['date'] = true;
}
?>
<div class="postwraps sixteen columns showajaxcontent border-color">
<div class="fifteensp columns offset-by-half alpha">
<h2 class="titles" style="text-shadow:none!important;"><a
href="<?php echo $permalink ?>"
style="text-shadow:none!important;"><?php the_title(); ?></a>
</h2>
<hr />
</div>
<?php
if (post_password_required()) {
echo '<div class="fifteensp columns offset-by-half alpha pinfo">';
the_content();
echo '</div>';
} else {
if(count($topSection) > 0) {
?>
<div class="fifteensp columns offset-by-half alpha pinfo">
<?php if(isset($topSection['cats'])) { ?>
<div class="four columns alpha">
<strong><?php _e('Creative Fields', 'dronetv')?></strong>
<br />
<?php echo $categories; ?>
</div>
<?php } ?>
<?php if(isset($topSection['client'])) { ?>
<div class="four columns">
<strong><?php _e('Client', 'dronetv')?></strong>
<br />
<?php echo $work_client; ?>
</div>
<?php } ?>
<?php if(isset($topSection['url'])) { ?>
<div class="four columns">
<strong><?php _e('Project URL', 'dronetv')?></strong>
<br />
<a href="<?php echo $work_url; ?>" target="_blank"><?php
$work_url = str_replace('http://', '', $work_url);
if (strlen($work_url) > 30) {
echo substr($work_url, 0, 30)."...";
} else {
echo $work_url;
}
?></a>
</div>
<?php } ?>
<?php if(isset($topSection['date'])) { ?>
<div class="three columns omega">
<strong><?php _e('Completion Date', 'dronetv')?></strong><br />
<?php echo $work_date; ?>
</div>
<?php } ?>
<br class="clear" />
<hr />
</div>
<?php } ?>
<?php
$sharittop = of_get_option('md_social_post_disable_top');
if (!$sharittop) {
$coln = 'twelve';
} else {
$coln = 'fifteen';
}
$workdesc = '<br class="clear" /><div class="fifteensp columns offset-by-half alpha fitvids">';
if (!$sharittop) {
$workdesc .= '<div class="'.$coln.' columns alpha">';
}
$workdesc .= apply_filters('the_content', $post->post_content);
if (!$sharittop) {
$workdesc .= ' </div>';
}
if (!$sharittop) {
$workdesc .= '<div class="three columns resdontshow omega sharing">';
$workdesc .= '<div class="sharingbottom border-color tops">
<strong>'.__('SHARE', 'dronetv').'</strong>
<br class="clear" />
<div class="buttons">';
$pimg = getThumb('large');
$ptitle = get_the_title();
$workdesc .= showshareingpost($permalink, @$pimg[0], @$ptitle, false, 1);
$workdesc .= '</div></div></div>';
}
$workdesc .= '</div>';
?>
<?php
/// SHOW PROJECT DESCRIPTION
if ($descpos == 'top') {
echo $workdesc;
}
?>
<br class="clear" />
<div class="postcontent fitvids">
<?php
$s1 = 0;
$s2 = 0;
$mediacaption = unserialize(get_post_meta($post->ID, 'work-media-caption', true));
$mediavideo = unserialize(get_post_meta($post->ID, 'work-media-video', true));
if (is_array($work_media)) {
foreach ($work_media as $v) {
if ($v == 'videoembed') {
echo '<div class="contentvideos fifteen columns offset-by-half alpha">'.stripslashes($mediavideo[$s1]).'</div>';
$s1++;
} else {
echo '<div class="contentimages fifteen columns offset-by-half alpha">';
echo '<img src="'.stripslashes($v).'" />';
if ($mediacaption[$s2] != "") {
echo '<div class="caption">'.stripslashes($mediacaption[$s2]).'</div>';
}
echo '</div>';
$s2++;
}
echo '<div class="fifteen columns offset-by-half alpha resdontshow"><hr></div>';
}
}
?>
<br class="clear" />
</div>
<?php
/// SHOW PROJECT DESCRIPTION
if ($descpos == 'bottom') {
echo $workdesc;
echo '<div class="fifteen columns offset-by-half alpha resdontshow"><hr></div>';
}
?>
<div class="fifteensp columns offset-by-half alpha" style="margin-bottom:10px;">
<div class="sharingbottom border-color bottoms">
<?php if (!of_get_option('md_social_post_disable_bottom')) {?>
<div class="resdontshow shr">
<strong><?php _e('SHARE : ', 'dronetv');?></strong>
</div>
<?php echo showshareingpost($permalink, @$pimg[0], @$ptitle, false); ?>
<?php } ?>
</div>
<hr class="resshow border-color-works" />
<div class="navigate pull-right">
<span class="pname"></span>
<a href="<?php echo get_home_url(); ?>" data-title="All"
title="<?php echo __("All Projects", "dronetv");?>"
data-type="works" data-token="<?php echo $token?>"
class="navigate parent getworks-showmsg gohome"> </a>
<?php if (!empty($prev_post['ID'])) { ?>
<a href="<?php echo get_permalink($prev_post['ID']); ?>"
data-type="works" data-token="<?php echo $token?>"
data-id="<?php echo $prev_post['ID']?>"
title="<?php echo htmlspecialchars($prev_post['post_title'])?>"
class="navigate back getworks-nextback getworks-showmsg"> </a>
<?php } ?>
<?php if (!empty($next_post['ID'])) { ?>
<a href="<?php echo get_permalink($next_post['ID']); ?>"
data-type="works" data-token="<?php echo $token?>"
data-id="<?php echo $next_post['ID']?>"
title="<?php echo htmlspecialchars($next_post['post_title'])?>"
class="navigate next getworks-nextback getworks-showmsg"> </a>
<?php } ?>
</div>
</div>
<br class="clear" />
<br class="clear" />
<?php
// password protected
}
?>
</div>
</div>