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