0
|
1 |
<?php |
5
|
2 |
/* |
|
3 |
* Template - Portfolio post |
|
4 |
* Version: 1.3 |
|
5 |
*/ |
0
|
6 |
get_header(); ?> |
5
|
7 |
<div class="content-area"> |
|
8 |
<div id="container" class="site-content site-main"> |
|
9 |
<div id="content" class="hentry"> |
0
|
10 |
<div class="breadcrumbs home_page_title entry-header"> |
5
|
11 |
<?php global $post; |
|
12 |
$title = get_the_title(); |
|
13 |
echo empty( $title ) ? '(' . __( 'No title', 'portfolio-pro' ) . ')' : $title; ?> |
|
14 |
</div> |
|
15 |
<?php $pdfprnt_options = get_option('pdfprnt_options_array'); |
|
16 |
if ( empty( $pdfprnt_options ) ) |
|
17 |
$pdfprnt_options = get_option('pdfprntpr_options_array'); |
|
18 |
if ( isset( $pdfprnt_options ) && is_array( $pdfprnt_options ) && true === in_array( 'portfolio', $pdfprnt_options['use_types_posts'] ) ) { |
|
19 |
if ( function_exists( 'pdfprnt_show_buttons_for_bws_portfolio_post' ) ) |
|
20 |
echo pdfprnt_show_buttons_for_bws_portfolio_post(); |
|
21 |
elseif ( function_exists( 'pdfprntpr_show_buttons_for_bws_portfolio_post' ) ) |
|
22 |
echo pdfprntpr_show_buttons_for_bws_portfolio_post(); |
|
23 |
} |
|
24 |
|
|
25 |
global $wp_query; |
0
|
26 |
while ( have_posts() ) : the_post(); ?> |
|
27 |
<div class="portfolio_content entry-content"> |
|
28 |
<div class="entry"> |
|
29 |
<?php global $post; |
5
|
30 |
$portfolio_options = get_option( 'prtfl_options' ); |
|
31 |
$meta_values = get_post_custom( $post->ID ); |
|
32 |
$post_thumbnail_id = get_post_thumbnail_id( $post->ID ); |
0
|
33 |
if ( empty ( $post_thumbnail_id ) ) { |
|
34 |
$args = array( |
5
|
35 |
'post_parent' => $post->ID, |
|
36 |
'post_type' => 'attachment', |
|
37 |
'post_mime_type' => 'image', |
|
38 |
'orderby' => 'menu_order', |
|
39 |
'order' => 'ASC', |
|
40 |
'numberposts' => 1 |
0
|
41 |
); |
5
|
42 |
$attachments = get_children( $args ); |
|
43 |
$post_thumbnail_id = key($attachments); |
0
|
44 |
} |
5
|
45 |
$image = wp_get_attachment_image_src( $post_thumbnail_id, 'portfolio-thumb' ); |
|
46 |
$image_large = wp_get_attachment_image_src( $post_thumbnail_id, 'large' ); |
|
47 |
$image_alt = get_post_meta( $post_thumbnail_id, '_wp_attachment_image_alt', true ); |
|
48 |
$image_desc = get_post($post_thumbnail_id); |
|
49 |
$image_desc = $image_desc->post_content; |
|
50 |
$full_descr = $post->post_content != "" ? $post->post_content : ''; |
|
51 |
$post_meta = get_post_meta( $post->ID, 'prtfl_information', true ); |
|
52 |
$date_compl = isset( $post_meta['_prtfl_date_compl'] ) ? $post_meta['_prtfl_date_compl'] : ''; |
|
53 |
if ( ! empty( $date_compl ) && 'in progress' != $date_compl) { |
|
54 |
$date_compl = explode( "/", $date_compl ); |
|
55 |
$date_compl = date( get_option( 'date_format' ), strtotime( $date_compl[1] . "-" . $date_compl[0] . '-' . $date_compl[2] ) ); |
|
56 |
} |
|
57 |
$link = isset( $post_meta['_prtfl_link'] ) ? $post_meta['_prtfl_link'] : ''; |
|
58 |
if ( empty( $full_descr ) ) |
|
59 |
$full_descr = isset( $post_meta['_prtfl_short_descr'] ) ? $post_meta['_prtfl_short_descr'] : ''; |
|
60 |
$svn = $post_meta['_prtfl_svn']; |
|
61 |
if ( ! empty( $image[0] ) ) { ?> |
|
62 |
<div class="portfolio_thumb"> |
|
63 |
<a class="lightbox" rel="portfolio_fancybox" href="<?php echo $image_large[0]; ?>" title="<?php echo $image_desc; ?>"> |
|
64 |
<img src="<?php echo $image[0]; ?>" width="<?php echo $portfolio_options['prtfl_custom_size_px'][0][0]; ?>" height="<?php echo $portfolio_options['prtfl_custom_size_px'][0][1]; ?>" alt="<?php echo $image_alt; ?>" /> |
|
65 |
</a> |
|
66 |
</div><!-- .portfolio_thumb --> |
|
67 |
<?php } ?> |
0
|
68 |
<div class="portfolio_short_content"> |
|
69 |
<?php if ( 1 == $portfolio_options['prtfl_date_additional_field'] ) { ?> |
|
70 |
<p> |
|
71 |
<span class="lable"><?php echo $portfolio_options['prtfl_date_text_field']; ?></span> <?php echo $date_compl; ?> |
|
72 |
</p> |
|
73 |
<?php } |
|
74 |
$user_id = get_current_user_id(); |
|
75 |
if ( 1 == $portfolio_options['prtfl_link_additional_field'] ) { |
5
|
76 |
if ( false !== parse_url( $link ) ) { ?> |
|
77 |
<?php if ( ( 0 == $user_id && 0 == $portfolio_options['prtfl_link_additional_field_for_non_registered'] ) || 0 != $user_id ) { ?> |
0
|
78 |
<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <a href="<?php echo $link; ?>"><?php echo $link; ?></a></p> |
|
79 |
<?php } else { ?> |
|
80 |
<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <?php echo $link; ?></p> |
5
|
81 |
<?php } |
|
82 |
} else { ?> |
|
83 |
<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <?php echo $link; ?></p> |
|
84 |
<?php } |
|
85 |
} |
|
86 |
if ( 1 == $portfolio_options['prtfl_description_additional_field'] ) { ?> |
|
87 |
<p><span class="lable"><?php echo $portfolio_options['prtfl_description_text_field']; ?></span> <?php echo str_replace("\n", "<br />", $full_descr); ?></p> |
0
|
88 |
<?php } |
5
|
89 |
if ( 0 != $user_id && $portfolio_options ) { |
|
90 |
if ( 1 == $portfolio_options['prtfl_svn_additional_field'] ) { ?> |
0
|
91 |
<p><span class="lable"><?php echo $portfolio_options['prtfl_svn_text_field']; ?></span> <?php echo $svn; ?></p> |
|
92 |
<?php } |
5
|
93 |
if ( 1 == $portfolio_options['prtfl_executor_additional_field'] ) { |
0
|
94 |
$executors_profile = wp_get_object_terms( $post->ID, 'portfolio_executor_profile' ); ?> |
|
95 |
<p><span class="lable"><?php echo $portfolio_options['prtfl_executor_text_field']; ?></span> |
|
96 |
<?php $count = 0; |
5
|
97 |
foreach ( $executors_profile as $profile ) { |
|
98 |
if ( $count > 0 ) |
|
99 |
echo ', '; ?> |
|
100 |
<a href="<?php echo get_term_link( $profile->slug, 'portfolio_executor_profile'); ?>" title="<?php echo $profile->name; ?> profile" target="_blank"><?php echo $profile->name; ?></a> |
0
|
101 |
<?php $count++; |
|
102 |
} ?> |
|
103 |
</p> |
|
104 |
<?php } |
|
105 |
} ?> |
5
|
106 |
</div><!-- .portfolio_short_content --> |
0
|
107 |
<div class="portfolio_images_block"> |
5
|
108 |
<?php $args = array( |
|
109 |
'post_parent' => $post->ID, |
|
110 |
'post_type' => 'attachment', |
|
111 |
'post_mime_type' => 'image', |
|
112 |
'numberposts' => -1, |
|
113 |
'orderby' => 'menu_order', |
|
114 |
'order' => 'ASC', |
|
115 |
'exclude' => $post_thumbnail_id |
0
|
116 |
); |
5
|
117 |
$attachments = get_children( $args ); |
|
118 |
$array_post_thumbnail_id = array_keys( $attachments ); |
|
119 |
$count_element = count( $array_post_thumbnail_id ); |
|
120 |
|
|
121 |
while ( list( $key, $value ) = each( $array_post_thumbnail_id ) ) { |
|
122 |
$image = wp_get_attachment_image_src( $value, 'portfolio-photo-thumb' ); |
|
123 |
$image_large = wp_get_attachment_image_src( $value, 'large' ); |
|
124 |
$image_alt = get_post_meta( $value, '_wp_attachment_image_alt', true ); |
|
125 |
$image_title = get_post_meta( $value, '_wp_attachment_image_title', true ); |
|
126 |
$image_desc = get_post($value); |
|
127 |
$image_desc = $image_desc->post_content; |
|
128 |
|
|
129 |
if ( 0 == $key ) { ?> |
|
130 |
<span class="lable"><?php echo $portfolio_options['prtfl_screenshot_text_field']; ?></span> |
0
|
131 |
<div class="portfolio_images_rows"> |
|
132 |
<?php } ?> |
|
133 |
<div class="portfolio_images_gallery"> |
|
134 |
<a class="lightbox" rel="portfolio_fancybox" href="<?php echo $image_large[0]; ?>" title="<?php echo $image_desc; ?>"> |
|
135 |
<img src="<?php echo $image[0]; ?>" width="<?php echo $portfolio_options['prtfl_custom_size_px'][1][0]; ?>" height="<?php echo $portfolio_options['prtfl_custom_size_px'][1][1]; ?>" alt="<?php echo $image_alt; ?>" /> |
|
136 |
</a> |
|
137 |
<br /><?php echo $image_title; ?> |
|
138 |
</div> |
5
|
139 |
<?php if ( 0 == ( $key + 1 ) % $portfolio_options['prtfl_custom_image_row_count'] && 0 != $key && $key + 1 != $count_element) { ?> |
|
140 |
</div><!-- .portfolio_images_rows --> |
0
|
141 |
<div class="portfolio_images_rows"> |
|
142 |
<?php } |
|
143 |
} |
5
|
144 |
if ( 0 < $count_element ) { ?> |
0
|
145 |
</div><!-- .portfolio_images_rows --> |
|
146 |
<?php } ?> |
5
|
147 |
</div><!-- .portfolio_images_block --> |
|
148 |
</div><!-- .entry --> |
0
|
149 |
<div class="entry_footer"> |
|
150 |
<div class="read_more"> </div> |
5
|
151 |
<?php $terms = wp_get_object_terms( $post->ID, 'portfolio_technologies' ); |
|
152 |
if ( is_array( $terms ) && 0 < count( $terms ) ) { ?> |
0
|
153 |
<div class="portfolio_terms"><?php echo $portfolio_options['prtfl_technologies_text_field']; ?> |
5
|
154 |
<?php $count = 0; |
|
155 |
foreach ( $terms as $term ) { |
|
156 |
if ( $count > 0 ) |
|
157 |
echo ', '; |
|
158 |
echo '<a href="' . get_term_link( $term->slug, 'portfolio_technologies') . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name . '</a>'; |
|
159 |
$count++; |
|
160 |
} ?> |
|
161 |
</div><!-- .portfolio_terms --> |
0
|
162 |
<?php } ?> |
5
|
163 |
</div><!-- .entry_footer --> |
|
164 |
</div><!-- .portfolio_content --> |
|
165 |
<?php endwhile; |
|
166 |
if ( ( ! empty( $image[0] ) || ( ! empty( $attachments ) ) ) ) { ?> |
|
167 |
<script type="text/javascript"> |
|
168 |
(function($){ |
|
169 |
$(document).ready(function(){ |
|
170 |
<?php if ( ! function_exists( 'is_plugin_active' ) ) |
|
171 |
require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
172 |
$all_plugins = get_plugins(); |
|
173 |
if ( ( ! is_plugin_active( 'gallery-plugin-pro/gallery-plugin-pro.php' ) ) || ( isset( $all_plugins["gallery-plugin-pro/gallery-plugin-pro.php"]["Version"] ) && "1.3.0" >= $all_plugins["gallery-plugin-pro/gallery-plugin-pro.php"]["Version"] ) ) { ?> |
|
174 |
$("a[rel=portfolio_fancybox]").fancybox({ |
|
175 |
'transitionIn' : 'elastic', |
|
176 |
'transitionOut' : 'elastic', |
|
177 |
'titlePosition' : 'inside', |
|
178 |
'speedIn' : 500, |
|
179 |
'speedOut' : 300, |
|
180 |
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) { |
|
181 |
return '<span id="fancybox-title-inside">' + ( title.length ? title + '<br />' : '' ) + 'Image ' + ( currentIndex + 1 ) + ' / ' + currentArray.length + '</span>'; |
|
182 |
} |
|
183 |
}); |
|
184 |
<?php } else { ?> |
|
185 |
$("a[rel=portfolio_fancybox]").fancybox({ |
|
186 |
openSpeed : 500, |
|
187 |
closeSpeed : 300, |
|
188 |
helpers : { |
|
189 |
title : { type : 'inside' } |
|
190 |
}, |
|
191 |
prevEffect : 'fade', |
|
192 |
nextEffect : 'fade', |
|
193 |
openEffect : 'elastic', |
|
194 |
closeEffect : 'elastic', |
|
195 |
beforeLoad: function() { |
|
196 |
this.title = '<span id="fancybox-title-inside">' + ( this.title.length ? this.title + '<br />' : '' ) + 'Image ' + ( this.index + 1 ) + ' / ' + this.group.length + '</span>'; |
|
197 |
} |
|
198 |
}); |
|
199 |
<?php } ?> |
|
200 |
}); |
|
201 |
})(jQuery); |
|
202 |
</script> |
|
203 |
<?php } ?> |
0
|
204 |
</div><!-- #content --> |
|
205 |
</div><!-- #container --> |
5
|
206 |
</div><!-- .content-area --> |
0
|
207 |
<?php get_sidebar(); ?> |
|
208 |
<?php get_footer(); ?> |