-
Notifications
You must be signed in to change notification settings - Fork 1
/
single-portfolio.php
267 lines (237 loc) · 9.23 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
<?php
/**
* Single Post Template: Portfolio Post Template
* Description: This part is optional, but helpful for describing the Post Template
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package understrap
*/
get_header(); ?>
<div class="wrapper" id="single-wrapper">
<div id="content" class="container<?php echo $postfix; ?>">
<div id="primary" class="content-area <?php //echo $contentwidth ?> portfolio-page">
<main id="main" class="site-main" role="main">
<?php if ( function_exists('yoast_breadcrumb') ) {
$yoast_links_options = get_option( 'wpseo_internallinks' );
$yoast_bc_enabled=$yoast_links_options['breadcrumbs-enable'];
if ($yoast_bc_enabled) { ?>
<div class="breadcrumb">
<?php yoast_breadcrumb('<p id="breadcrumbs"> <i class="fa fa-home"></i> ','</p>'); ?>
</div>
<?php }
} ?>
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<?php
if (get_theme_mod( 'show_content_attachment_image', 'true') != '' ) {
?>
<?php if ( has_post_thumbnail() ) { ?>
<figure class="attachment-header-image">
<?php
if ( (get_theme_mod( 'show_sidebar') != 'true' ) || (get_theme_mod( 'content_width') == 'fullwidth') ) {
the_post_thumbnail('header-image-large', array( 'class' => 'img-responsive', 'style' => 'width: 100%' ) );
} else {
the_post_thumbnail('header-image-medium', array( 'class' => 'img-responsive', 'style' => 'width: 100%' ) );
}
?>
<figcaption class="attachment-header-image-caption" style="text-align: center">
<?php
// See http://www.bobz.co/how-to-get-attachment-image-caption-alt-or-description/
// and http://codex.wordpress.org/Function_Reference/wp_get_attachment_metadata#Usage
$thumb_img = get_post( get_post_thumbnail_id() ); // Get post by ID
?>
<div class="h2"><?php echo $thumb_img->post_title; // Display Caption ?></div>
<p><?php echo $thumb_img->post_excerpt; // Display Description ?></p>
</figcaption>
</figure>
<div class="entry-content">
<?php the_content(); ?>
</div>
<?php
} }
?>
<?php
// Display Gallery left or right based on Metabox selection
$direction = get_post_meta( get_the_ID(), 'portfolio_layout', true );
$the_content_pull = "";
if ($direction == 'gallery_left') {
$the_content_pull = "pull-right";
}
?>
<div class="row">
<div class="col-sm-4 <?php echo $the_content_pull; ?>">
<div class="project-info">
<?php
$project_title = get_post_meta( get_the_ID(), '_lathom_project_title', true );
$project_logo = get_post_meta( get_the_ID(), '_lathom_project_logo', true );
$project_clientname = get_post_meta( get_the_ID(), '_lathom_project_clientname', true );
$project_url = get_post_meta( get_the_ID(), '_lathom_project_url', true );
$project_startdate = get_post_meta( get_the_ID(), '_lathom_project_startdate', true );
$project_enddate = get_post_meta( get_the_ID(), '_lathom_project_enddate', true );
$project_tasks = get_post_meta( get_the_ID(), '_lathom_project_tasks', true ); // (array)
$project_wysiwyg_text = get_post_meta( get_the_ID(), '_lathom_project_wysiwyg_text', true );
$project_attachment_list = get_post_meta( get_the_ID(), '_lathom_project_attachment_list', true ); // (array)
?>
<h2><?php echo __( 'Project Details', 'understrap' ); ?></h2>
<?php
// Project Title
if (!empty($project_title) ) { ?>
<div class="project-title">
<p>
<strong><?php echo __( 'Project Title: ', 'understrap' );?></strong><br>
<span class=""><?php echo esc_html( $project_title ); ?></span>
</p>
</div>
<?php
}
// Project Logo
if (!empty($project_logo) ) { ?>
<div class="project-logo">
<!-- <h3><?php echo __( 'Project Logo', 'understrap' );?></h3> -->
<span class="project-logo">
<?php $logo = get_post_meta( get_the_ID(), '_lathom_project_logo');
echo '<img src="' .$logo[0] . '" class="img-responsive center-block">';
?></span><br>
</div>
<?php
}
// Client Info - Name, Link
if (!empty($project_clientname) || !empty(get_post_meta( get_the_ID(), '_lathom_project_url', true ))) { ?>
<div class="project-clientinfo">
<p>
<strong><?php echo __( 'Client Information: ', 'understrap' );?></strong><br>
<?php echo esc_html( $project_clientname ); ?>
</p>
</div>
<div class="project-links">
<p>
<strong><?php echo __( 'Links: ', 'understrap' );?></strong><br>
<?php $entries = get_post_meta( get_the_ID(), '_lathom_project_url', true );
foreach((array)$entries as $key => $entry) {
echo '<span class="fa fa-link"></span> <a href="' . esc_html( $entry ) . '" title="' . esc_html( $project_clientname ) . '" target="_blank">' . esc_html( $entry ) . '</a><br>';
} //* end foreach; ?>
</p>
</div>
<?php
}
// Project Duration
if (!empty($project_startdate) || !empty($project_enddate)) { ?>
<hr>
<div class="project-duration">
<p>
<strong><?php echo __( 'Project Duration: ', 'understrap' );?></strong><br>
<?php if (!empty($project_startdate) ) { ?>
<span><span class="fa fa-calendar"></span> <?php echo esc_html( $project_startdate ); ?> <?php echo __( 'until ', 'understrap' );?></span>
<?php }
if (!empty($project_enddate) ) { ?>
<span><span class="fa fa-calendar"></span> <?php echo esc_html( $project_enddate ); ?></span>
<?php } ?>
</p>
</div>
<?php
}
// Project Tasks
if (!empty($project_tasks)) { ?>
<hr>
<div class="project-tasks">
<strong><?php echo __( 'Project Tasks: ', 'understrap' );?></strong>
<ul class="project-task-list">
<?php $entries = get_post_meta(get_the_ID() , '_lathom_project_tasks', true);
foreach((array)$entries as $key => $entry) {
echo '<li>' . $entry . '</li>';
} //* end foreach; ?>
</ul>
</div>
<?php
}
// Project Description
if (!empty($project_wysiwyg_text)) { ?>
<hr>
<div class="project-description">
<strong><?php echo __( 'Project Description: ', 'understrap' );?></strong><br>
<?php echo $project_wysiwyg_text; ?>
</div>
<?php
}
// Attachment List
if (!empty($project_attachment_list)) { ?>
<hr>
<div class="project-attachments">
<strong><?php echo __( 'Project Attachments: ', 'understrap' ); ?></strong>
<ul class="attachment-list">
<?php echo cmb2_output_attachments( '_lathom_project_attachment_list'); ?>
</ul>
</div>
<?php } ?>
</div>
</div>
<div class="col-sm-8">
<?php cmb2_output_gallery( '_lathom_project_gallery_list', 'medium' ); ?>
</div>
</div><!-- .entry-content -->
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'understrap' ),
'after' => '</div>',
) );
?>
<footer class="entry-footer">
<?php understrap_entry_footer(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->
<?php understrap_post_nav(); ?>
<?php
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
<?php endwhile; // End of the loop. ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php //if ( get_theme_mod( 'show_sidebar', 'true') ) : get_template_part('sidebar'); endif; ?>
</div><!-- Container end -->
</div><!-- Wrapper end -->
<script>
jQuery(document).ready(function() {
// var owl = jQuery('.owl-carousel');
// owl.owlCarousel({
// items: 1,
// loop: true,
// autoplay:true,
// autoplayTimeout: 5000,
// animateOut: 'fadeOut',
// animateIn: 'fadeIn',
// nav: true,
// dots: true,
// autoplayHoverPause:true,
// margin:0,
// autoHeight:true,
// video: true
// });
jQuery(document).ready(function(){
jQuery(".owl-carousel").owlCarousel({
items: 1,
loop: true,
dots: true,
autoplay: true,
autoplayTimeout: 5000,
autoplayHoverPause: true,
autoHeight: true,
// animateOut: true,
// animateIn: true,
});
});
jQuery('.play').on('click',function(){
owl.trigger('autoplay.play.owl',[1000])
});
jQuery('.stop').on('click',function(){
owl.trigger('autoplay.stop.owl')
});
});
</script>
<?php get_footer(); ?>