forked from themebeans/trim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle-portfolio.php
176 lines (137 loc) · 4.77 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
<?php
/**
* The template for displaying the portfolio singular page.
*
* @package Trim
* @link https://themebeans.com/themes/trim
*/
get_header();
// VIEW COUNTER
bean_setPostViews( get_the_ID() );
// META
$gallery_layout = get_post_meta( $post->ID, '_bean_gallery_layout', true );
$portfolio_review = get_post_meta( $post->ID, '_bean_portfolio_review', true );
$portfolio_type_audio = get_post_meta( $post->ID, '_bean_portfolio_type_audio', true );
$portfolio_type_video = get_post_meta( $post->ID, '_bean_portfolio_type_video', true );
// RANDOMIZE
$orderby = get_post_meta( $post->ID, '_bean_portfolio_randomize', true );
$orderby = ( $orderby == 'off' ) ? 'post__in' : 'rand';
// WE ARE USING THE GLOBAL THEME CUSTOMIZER VALUE AS PRIORITY, PORTFOLIO POST META SECONDARY
$portfolio_layout = get_post_meta( $post->ID, '_bean_portfolio_layout', true );
if ( $portfolio_layout == 'default' ) {
if ( get_theme_mod( 'theme_version', trim_defaults( 'theme_version' ) ) == 'theme_version_grid' ) {
$portfolio_layout = 'std'; } elseif ( get_theme_mod( 'theme_version', trim_defaults( 'theme_version' ) ) == 'theme_version_fullwidth' ) {
$portfolio_layout = 'fullwidth'; } elseif ( get_theme_mod( 'theme_version', trim_defaults( 'theme_version' ) ) == 'theme_version_fullscreen' ) {
$portfolio_layout = 'fullscreen'; } else {
$portfolio_layout = 'std'; }
} ?>
<?php
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
?>
<?php if ( ! post_password_required() ) { ?>
<?php if ( $portfolio_layout == 'std' or $portfolio_layout == 'fullwidth' or $portfolio_layout == 'fullscreen' ) { ?>
<?php
if ( $portfolio_layout == 'fullscreen' ) {
bean_gallery( $post->ID, 'port-full', 'fullscreen', $orderby, true );
}
?>
<article id="post-<?php the_ID(); ?>" <?php post_class( "$portfolio_layout single-page" ); ?>>
<div class="inner">
<?php
if ( $portfolio_layout == 'fullscreen' ) {
if ( $portfolio_type_video != 'on' ) {
get_template_part( 'content', 'portfolio-media' );
}
}
?>
<?php
if ( $portfolio_layout == 'fullwidth' ) {
get_template_part( 'content', 'portfolio-media' );
bean_gallery( $post->ID, 'port-full', $gallery_layout, $orderby, true );
}
?>
<div class="entry-content">
<div>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php the_content(); ?>
</div>
<?php get_template_part( 'content', 'portfolio-meta' ); ?>
</div><!-- END .entry-content-->
<?php
if ( $portfolio_layout == 'std' ) {
get_template_part( 'content', 'portfolio-media' );
bean_gallery( $post->ID, 'port-full', $gallery_layout, $orderby, true );
}
?>
</div><!-- END .inner -->
</article>
<?php } ?>
<?php } ?>
<?php
endwhile;
endif;
if ( $portfolio_review ) {
if ( $portfolio_layout != 'fullscreen' ) {
?>
<article class="portfolio-review post">
<div class="inner">
<span class="quote-icon"></span>
<h2><?php echo esc_html( $portfolio_review ); ?></h2>
</div><!-- END .inner -->
</article>
<?php
}
}
if ( get_theme_mod( 'show_portfolio_sharing', trim_defaults( 'show_portfolio_sharing' ) ) == true ) {
if ( $portfolio_layout != 'fullscreen' ) {
?>
<article class="sidebar post">
<div class="inner">
<?php get_template_part( 'content', 'post-social' ); ?>
</div><!-- END .inner -->
</article>
<?php
}
}
// MORE LOOP PULL
$portfolio_more = get_post_meta( $post->ID, '_bean_portfolio_more', true );
if ( $portfolio_more == 'on' and get_theme_mod( 'show_portfolio_loop_single', trim_defaults( 'show_portfolio_loop_single' ) ) == true ) {
if ( $portfolio_layout == 'fullscreen' ) {
?>
<div id="masonry-container">
<div class="grid-width"></div><div class="gutter-width"></div>
<?php if ( get_theme_mod( 'show_portfolio_sharing', trim_defaults( 'show_portfolio_sharing' ) ) == true ) { ?>
<article class="sidebar post">
<div class="inner">
<?php get_template_part( 'content', 'post-social' ); ?>
</div><!-- END .inner -->
</article>
<?php } ?>
<?php if ( $portfolio_review ) { ?>
<article class="portfolio-review post">
<div class="inner">
<span class="quote-icon"></span>
<h2><?php echo esc_html( $portfolio_review ); ?></h2>
</div><!-- END .inner -->
</article>
<?php } ?>
<?php } ?>
<?php
$more_loop = get_theme_mod( 'portfolio_more_loop', trim_defaults( 'portfolio_more_loop' ) );
if ( $more_loop != '' ) {
switch ( $more_loop ) {
case 'related':
$terms = get_the_terms( $post->ID, 'portfolio_category' );
if ( $terms && ! is_wp_error( $terms ) ) :
get_template_part( 'content', 'post-related' );
endif;
break;
case 'more':
get_template_part( 'content', 'post-more' );
break;
}
}
}
get_footer();