-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsingle-portfolio.php
287 lines (198 loc) · 10 KB
/
single-portfolio.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
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<?php get_header();
$fwp = get_post_meta($post->ID, '_nectar_portfolio_item_layout', true);
$hidden_featured_media = get_post_meta($post->ID, '_nectar_hide_featured', true);
$hidden_project_title = get_post_meta($post->ID, '_nectar_hide_title', true);
global $post;
$featured_src = (has_post_thumbnail( $post->ID )) ? wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full') : array('empty') ;
$full_width_portfolio = (!empty($fwp) && $fwp == 'enabled') ? 'id="full_width_portfolio" data-featured-img="'. $featured_src[0] .'"' : null;
?>
<div <?php echo $full_width_portfolio; ?> >
<div class="row project-title">
<div class="container">
<div class="col span_12 section-title <?php if(empty($options['portfolio_social']) || $options['portfolio_social'] == 0 || empty($options['portfolio_date']) || $options['portfolio_date'] == 0 ) echo 'no-date'?>">
<h1><?php the_title(); ?></h1>
<?php
$options = get_option('salient');
//attempt to find parent portfolio page - if unsuccessful default to main portfolio page
global $post;
$terms = get_the_terms($post->id,"project-type");
$project_cat = null;
$portfolio_link = null;
if(empty($terms)) $terms = array('1' => (object) array('name' => 'nothing'));
foreach ( $terms as $term ) {
$project_cat = strtolower($term->name);
}
$page = get_page_by_title_search($project_cat);
if(empty($page)) $page = array( '0' => (object) array('ID' => 'nothing'));
$page_link = verify_portfolio_page($page[0]->ID);
//if a page has been found for the category
if(!empty($page_link)) {
$portfolio_link = $page_link; ?>
<div id="portfolio-nav">
<ul>
<li id="all-items"><a href="<?php echo $portfolio_link; ?>"><i class="icon-salient-back-to-all"></i></a></li>
</ul>
<ul class="controls">
<li id="prev-link"><?php be_next_post_link('%link','<i class="icon-salient-left-arrow-thin"></i>',TRUE, null,'project-type'); ?></li>
<li id="next-link"><?php be_previous_post_link('%link','<i class="icon-salient-right-arrow-thin"></i>',TRUE, null, 'project-type'); ?></li>
</ul>
</div>
<?php }
//if no category page exists
else {
$portfolio_link = get_portfolio_page_link(get_the_ID());
if(!empty($options['main-portfolio-link'])) $portfolio_link = $options['main-portfolio-link']; ?>
<div id="portfolio-nav">
<ul>
<li id="all-items"><a href="<?php echo $portfolio_link; ?>"><i class="icon-salient-back-to-all"></i></a></li>
</ul>
<ul class="controls">
<li id="prev-link"><?php next_post_link('%link','<i class="icon-salient-left-arrow-thin"></i>'); ?></li>
<li id="next-link"><?php previous_post_link('%link','<i class="icon-salient-right-arrow-thin"></i>'); ?></li>
</ul>
</div>
<?php } ?>
</div>
</div>
</div><!--/container-->
<div class="container-wrap">
<div class="container main-content">
<?php
$enable_gallery_slider = get_post_meta( get_the_ID(), '_nectar_gallery_slider', true ); ?>
<div class="row <?php if(!empty($enable_gallery_slider) && $enable_gallery_slider == 'on') echo 'gallery-slider'; ?>">
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<div id="post-area" class="col <?php if($fwp != 'enabled') { echo 'span_9'; } else { echo 'span_12'; } ?>">
<?php
if($hidden_featured_media != 'on') {
$video_embed = get_post_meta($post->ID, '_nectar_video_embed', true);
$video_m4v = get_post_meta($post->ID, '_nectar_video_m4v', true);
$video_ogv = get_post_meta($post->ID, '_nectar_video_ogv', true);
$video_poster = get_post_meta($post->ID, '_nectar_video_poster', true);
//Gallery
$wp_version = floatval(get_bloginfo('version'));
if(class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'second-slide') || !empty($enable_gallery_slider) && $enable_gallery_slider == 'on'){
if ( $wp_version < "3.6" ) {
if(MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'second-slide')) {
nectar_gallery($post->ID);
}
}
else {
if(!empty($enable_gallery_slider) && $enable_gallery_slider == 'on') { $gallery_ids = grab_ids_from_gallery(); ?>
<div class="flex-gallery">
<ul class="slides">
<?php
foreach( $gallery_ids as $image_id ) {
echo '<li>' . wp_get_attachment_image($image_id, '', false, $attr) . '</li>';
} ?>
</ul>
</div><!--/gallery-->
<?php }
}
}
//Video
else if( !empty($video_embed) || !empty($video_m4v) ){
$wp_version = floatval(get_bloginfo('version'));
//video embed
if( !empty( $video_embed ) ) {
echo '<div class="video">' . do_shortcode($video_embed) . '</div>';
}
//self hosted video pre 3-6
else if( !empty($video_m4v) && $wp_version < "3.6") {
echo '<div class="video">';
nectar_video($post->ID);
echo '</div>';
}
//self hosted video post 3-6
else if($wp_version >= "3.6"){
if(!empty($video_m4v) || !empty($video_ogv)) {
$video_output = '[video ';
if(!empty($video_m4v)) { $video_output .= 'mp4="'. $video_m4v .'" '; }
if(!empty($video_ogv)) { $video_output .= 'ogv="'. $video_ogv .'"'; }
$video_output .= ' poster="'.$video_poster.'"]';
echo '<div class="video">' . do_shortcode($video_output) . '</div>';
}
}
}
//Regular Featured Img
else {
if (has_post_thumbnail()) { echo get_the_post_thumbnail($post->ID, 'full', array('title' => '')); } else {
echo '<img src="'.get_template_directory_uri().'/img/no-portfolio-item.jpg" alt="no image added yet." />';
}
}
}
?>
<?php
//extra content
$options = get_option('salient');
if(!post_password_required()) {
$portfolio_extra_content = get_post_meta($post->ID, '_nectar_portfolio_extra_content', true);
if(!empty($portfolio_extra_content)){
echo '<div id="portfolio-extra">';
$extra_content = shortcode_empty_paragraph_fix(apply_filters( 'the_content', $portfolio_extra_content ));
echo do_shortcode($extra_content);
echo '</div>';
}
}
?>
<div class="comments-section">
<?php comments_template(); ?>
</div>
</div><!--/post-area-->
<?php if($fwp != 'enabled') { ?>
<div id="sidebar" class="col span_3 col_last" data-follow-on-scroll="<?php echo (!empty($options['portfolio_sidebar_follow']) && $options['portfolio_sidebar_follow'] == 1) ? 1 : 0; ?>">
<div id="sidebar-inner">
<div id="project-meta" data-sharing="<?php echo ( !empty($options['portfolio_social']) && $options['portfolio_social'] == 1 ) ? '1' : '0'; ?>">
<?php if(!empty($options['portfolio_date']) && $options['portfolio_date'] == 1) {
if( empty($options['portfolio_social']) || $options['portfolio_social'] == 0 ) { ?>
<ul class="sharing">
<li><?php echo '<span class="n-shortcode">'.nectar_love('return').'</span>'; ?></li>
<li>
<?php the_time('F d, Y'); ?>
</li>
</ul><!--sharing-->
<?php }
}
?>
<?php
// portfolio social sharting icons
if( !empty($options['portfolio_social']) && $options['portfolio_social'] == 1 ) {
echo '<div class="nectar-social sharing">';
echo '<span class="n-shortcode">'.nectar_love('return').'</span>';
//facebook
if(!empty($options['portfolio-facebook-sharing']) && $options['portfolio-facebook-sharing'] == 1) {
echo "<a class='facebook-share nectar-sharing' href='#' title='Share this'> <i class='icon-facebook'></i> <span class='count'></span></a>";
}
//twitter
if(!empty($options['portfolio-twitter-sharing']) && $options['portfolio-twitter-sharing'] == 1) {
echo "<a class='twitter-share nectar-sharing' href='#' title='Tweet this'> <i class='icon-twitter'></i> <span class='count'></span></a>";
}
//pinterest
if(!empty($options['portfolio-pinterest-sharing']) && $options['portfolio-pinterest-sharing'] == 1) {
echo "<a class='pinterest-share nectar-sharing' href='#' title='Pin this'> <i class='icon-pinterest'></i> <span class='count'></span></a>";
}
echo '</div>';
}
?>
<div class="clear"></div>
</div><!--project-meta-->
<?php the_content(); ?>
<?php
$project_attrs = get_the_terms( $post->ID, 'project-attributes' );
if (!empty($project_attrs)){ ?>
<ul class="project-attrs checks">
<?php
foreach($project_attrs as $attr){
echo '<li>' . $attr->name . '</li>';
}
?>
</ul>
<?php } ?>
</div>
</div><!--/sidebar-->
<?php }
endwhile; endif; ?>
</div>
</div><!--/container-->
</div><!--/container-wrap-->
</div><!--/if portfolio fullwidth-->
<?php get_footer(); ?>