forked from CCI-MOC/moc-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
single-portfolio.php
206 lines (191 loc) · 8.9 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
<?php
/**
* The template for displaying portfolio pages.
* @package etalon
* by KeyDesign */
?>
<?php
$redux_ThemeTek = get_option( 'redux_ThemeTek' );
$themetek_portfolio_page_showhide_title = get_post_meta( get_the_ID(), '_themetek_portfolio_page_showhide_title', true );
get_header();
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
// Get the featured image
$src = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'full', false, '' );
// Get metaboxes values from database
$values = get_post_custom( $post->ID );
$keydesign_page_portfolio_styles = isset( $values['page_portfolio_style'] ) ? esc_attr( $values['page_portfolio_style'][0] ) :'';
?>
<section id="single-page" class="section <?php echo esc_attr($post->post_name);?>">
<div class="portfolio-content <?php echo esc_html($keydesign_page_portfolio_styles); ?>">
<?php if ($keydesign_page_portfolio_styles == 'single-side'): ?>
<!-- Portfolio template: Single image side -->
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-7 col-lg-7">
<div class="featured-image single-image">
<?php
if( $src ) {
echo '<a data-size="' . esc_attr($src[1]) . 'x' . esc_attr($src[2]) . '" href="'.esc_url($src[0]).'" title="' . get_the_title() . '">
<img class="portfolio-image" src="'.esc_url($src[0]).'" alt="' . get_the_title() . '" />
</a>'; }
?>
</div>
</div>
<div class=" col-xs-12 col-sm-12 col-md-5 col-lg-5">
<div class="portfolio-block">
<?php if (isset($redux_ThemeTek['tek-portfolio-title'])) : ?>
<?php if ($redux_ThemeTek['tek-portfolio-title'] && empty($themetek_portfolio_page_showhide_title)) : ?>
<h1 class="portfolio-title"><?php the_title(); ?></h1>
<?php endif; ?>
<?php endif; ?>
<?php the_content();?>
</div>
<div class="portfolio-block portfolio-meta-parent">
<?php include( get_template_directory() . '/core/templates/portfolio/portfolio-meta.php'); ?>
</div>
</div>
</div>
</div>
<?php elseif ($keydesign_page_portfolio_styles == 'gallery-side'): ?>
<!-- Portfolio template: Gallery item side -->
<div class="container">
<div class="col-xs-12 col-sm-12 col-md-7 col-lg-7">
<div class="featured-gallery">
<?php
$args = array(
'post_type' => 'attachment',
'orderby' => 'date',
'order' => 'ASC',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID
);
$attachments = get_posts( $args );
if ($attachments) {
echo '<div class="owlslider-portfolio portfolio-gallery-content">';
foreach ( $attachments as $attachment ) {
$image_metadata = wp_get_attachment_metadata( $attachment->ID );
echo '<a data-size="' . esc_attr($image_metadata['width']) . 'x' . esc_attr($image_metadata['height']) . '" href="'.esc_url(wp_get_attachment_url($attachment->ID)).'" title="'.get_the_title().'">
<img src="'.esc_url(wp_get_attachment_url($attachment->ID)).'" class="portfolio-image" alt="'.get_the_title().'" />
</a>';
}
echo '</div>';
}
?>
</div>
</div>
<div class="portfolio-sidebar col-xs-12 col-sm-12 col-md-5 col-lg-5">
<div class="portfolio-block">
<?php if (isset($redux_ThemeTek['tek-portfolio-title'])) : ?>
<?php if ($redux_ThemeTek['tek-portfolio-title'] && empty($themetek_portfolio_page_showhide_title)) : ?>
<h1 class="portfolio-title"><?php the_title(); ?></h1>
<?php endif; ?>
<?php endif; ?>
<?php the_content();?>
</div>
<div class="portfolio-block portfolio-meta-parent">
<?php include( get_template_directory() . '/core/templates/portfolio/portfolio-meta.php'); ?>
</div>
</div>
</div>
<?php elseif ($keydesign_page_portfolio_styles == 'gallery-list'): ?>
<!-- Portfolio template: Gallery item list -->
<div class="container">
<div class="portfolio-gallery col-xs-12 col-sm-12 col-md-7 col-lg-7">
<div class="featured-gallery">
<?php
$args = array(
'post_type' => 'attachment',
'orderby' => 'date',
'order' => 'ASC',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID
);
$attachments = get_posts( $args );
if ($attachments) {
echo '<div class="portfolio-gallery-list portfolio-gallery-content">';
foreach ( $attachments as $attachment ) {
$image_metadata = wp_get_attachment_metadata( $attachment->ID );
echo '<div class="gallery-item-list">';
echo '<a data-size="' . esc_attr($image_metadata['width']) . 'x' . esc_attr($image_metadata['height']) . '" href="'.esc_url(wp_get_attachment_url($attachment->ID)).'" title="'.get_the_title().'"><img src="'.esc_url(wp_get_attachment_url($attachment->ID)).'" class="portfolio-image" alt="'.get_the_title().'" /></a>';
echo '</div>';
}
echo '</div>';
}
?>
</div>
</div>
<div class="portfolio-sidebar sidebar-list col-xs-12 col-sm-12 col-md-5 col-lg-5">
<div class="portfolio-block">
<?php if (isset($redux_ThemeTek['tek-portfolio-title'])) : ?>
<?php if ($redux_ThemeTek['tek-portfolio-title'] && empty($themetek_portfolio_page_showhide_title)) : ?>
<h1 class="portfolio-title"><?php the_title(); ?></h1>
<?php endif; ?>
<?php endif; ?>
<?php the_content();?>
</div>
<div class="portfolio-block portfolio-meta-parent">
<?php include( get_template_directory() . '/core/templates/portfolio/portfolio-meta.php'); ?>
</div>
</div>
</div>
<?php endif; ?>
<div class="row portfolio-navigation-links col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="container">
<div class="port-nav-prev col-xs-6 col-sm-6 col-md-6 col-lg-6">
<?php
$prev_post = get_adjacent_post(false, '', true);
if(!empty($prev_post)) {
echo '<a class="port-prev tt_button" href="' . esc_url(get_permalink($prev_post->ID)) . '" title="' . esc_html($prev_post->post_title) . '">' . esc_html__("Prev", "etalon") . '</a>';
}
?>
</div>
<div class="port-nav-next col-xs-6 col-sm-6 col-md-6 col-lg-6">
<?php $next_post = get_adjacent_post(false, '', false);
if(!empty($next_post)) {
echo '<a class="port-next tt_button" href="' . esc_url(get_permalink($next_post->ID)) . '" title="' . esc_html($next_post->post_title) . '">' . esc_html__("Next", "etalon") . '</a>';
}
?>
</div>
</div>
</div>
</div>
<?php endwhile; endif; ?>
</section>
<?php get_footer();?>
<!-- Image lightbox -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
<div class="pswp__bg"></div>
<div class="pswp__scroll-wrap">
<div class="pswp__container">
<div class="pswp__item"></div>
<div class="pswp__item"></div>
<div class="pswp__item"></div>
</div>
<div class="pswp__ui pswp__ui--hidden">
<div class="pswp__top-bar">
<div class="pswp__counter"></div>
<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
<div class="pswp__preloader">
<div class="pswp__preloader__icn">
<div class="pswp__preloader__cut">
<div class="pswp__preloader__donut"></div>
</div>
</div>
</div>
</div>
<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
</button>
<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
</button>
<div class="pswp__caption">
<div class="pswp__caption__center"></div>
</div>
</div>
</div>
</div>